Migrate calls from Players.Length to ActivePlayers

As pointed out by @QuiCM, TShock.Players is actually an array and not a
smarter collection, so length will return the total collection size and
not the active players. An earlier commit was added that gives TSPlayer
an ICollection<TSPlayer> that contains only active players. This is now
the basis of determining the number of active players on the server.
This commit is contained in:
Lucas Nicodemus 2017-12-31 01:13:33 -07:00
parent 17cfdc3a16
commit 521283c36b
4 changed files with 6 additions and 6 deletions

View file

@ -1621,7 +1621,7 @@ namespace TShockAPI
if (Config.EnableGeoIP && TShock.Geo != null)
{
Log.Info("{0} ({1}) from '{2}' group from '{3}' joined. ({4}/{5})", player.Name, player.IP,
player.Group.Name, player.Country, TShock.Players.Length,
player.Group.Name, player.Country, TSPlayer.ActivePlayers.Count,
TShock.Config.MaxSlots);
if (!player.SilentJoinInProgress)
Utils.Broadcast(string.Format("{0} ({1}) has joined.", player.Name, player.Country), Color.Yellow);
@ -1629,7 +1629,7 @@ namespace TShockAPI
else
{
Log.Info("{0} ({1}) from '{2}' group joined. ({3}/{4})", player.Name, player.IP,
player.Group.Name, TShock.Players.Length, TShock.Config.MaxSlots);
player.Group.Name, TSPlayer.ActivePlayers.Count, TShock.Config.MaxSlots);
if (!player.SilentJoinInProgress)
Utils.Broadcast(player.Name + " has joined.", Color.Yellow);
}