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:
parent
17cfdc3a16
commit
521283c36b
4 changed files with 6 additions and 6 deletions
|
|
@ -1108,7 +1108,7 @@ namespace TShockAPI
|
|||
}
|
||||
else
|
||||
{
|
||||
invasionSize = 100 + (TShock.Config.InvasionMultiplier * TShock.Players.Length);
|
||||
invasionSize = 100 + (TShock.Config.InvasionMultiplier * TSPlayer.ActivePlayers.Count);
|
||||
}
|
||||
|
||||
// Order matters
|
||||
|
|
@ -1147,7 +1147,7 @@ namespace TShockAPI
|
|||
{
|
||||
Console.Title = string.Format("{0}{1}/{2} on {3} @ {4}:{5} (TShock for Terraria v{6})",
|
||||
!string.IsNullOrWhiteSpace(TShock.Config.ServerName) ? TShock.Config.ServerName + " - " : "",
|
||||
empty ? 0 : TShock.Players.Length,
|
||||
empty ? 0 : TSPlayer.ActivePlayers.Count,
|
||||
TShock.Config.MaxSlots, Main.worldName, Netplay.ServerIP.ToString(), Netplay.ListenPort, TShock.VersionNum);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue