Add TSPlayer.ActivePlayers

This commit is contained in:
Lucas Nicodemus 2017-12-31 01:13:03 -07:00
parent 4eebaf6c44
commit 17cfdc3a16
2 changed files with 13 additions and 1 deletions

View file

@ -74,6 +74,18 @@ namespace TShockAPI
/// </summary>
public static readonly TSPlayer All = new TSPlayer("All");
/// <summary>
/// Gets the number of active players on the server.
/// </summary>
/// <returns>The number of active players on the server.</returns>
public static ICollection<TSPlayer> ActivePlayers
{
get
{
return TShock.Players.Where(p => null != p && p.TPlayer.active) as ICollection<TSPlayer>;
}
}
/// <summary>
/// Finds a TSPlayer based on name or ID
/// </summary>