Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions EXILED/Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,19 @@ public Player(GameObject gameObject)
/// </summary>
public static IReadOnlyCollection<Player> List => Dictionary.Values.ToList();

/// <summary>
/// Gets an <see cref="IEnumerable{T}"/> of all <see cref="Player"/>'s on the server.
/// This property should be used for enumeration (e.g. LINQ) as it doesn't create a new list, improving performance.
/// </summary>
public static IEnumerable<Player> Enumerable => Dictionary.Values;

/// <summary>
/// Gets the number of players currently on the server.
/// </summary>
/// <seealso cref="List"/>
/// <seealso cref="Enumerable"/>
public static int Count => Dictionary.Count;

/// <summary>
/// Gets a <see cref="Dictionary{TKey, TValue}"/> containing cached <see cref="Player"/> and their user ids.
/// </summary>
Expand Down
7 changes: 2 additions & 5 deletions EXILED/Exiled.API/Features/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,8 @@ public static bool FriendlyFire
}
}

/// <summary>
/// Gets the number of players currently on the server.
/// </summary>
/// <seealso cref="Player.List"/>
public static int PlayerCount => Player.Dictionary.Count;
/// <inheritdoc cref="Player.Count"/>
public static int PlayerCount => Player.Count;

/// <summary>
/// Gets or sets the maximum number of players able to be on the server.
Expand Down
Loading