Remove Utils.GetPlayers().
This is a public method that only has two uses in TShock and both of them are listing players to a player. A foreach isn't rocket science and this method was originally created just because there was no good object to iterate on (e.g., a TSPlayer array).
This commit is contained in:
parent
48393d60c7
commit
f06d1fd238
3 changed files with 31 additions and 29 deletions
|
|
@ -4820,8 +4820,26 @@ namespace TShockAPI
|
|||
}
|
||||
|
||||
args.Player.SendSuccessMessage("Online Players ({0}/{1})", TShock.Players.Length, TShock.Config.MaxSlots);
|
||||
|
||||
var players = new List<string>();
|
||||
|
||||
foreach (TSPlayer ply in TShock.Players)
|
||||
{
|
||||
if (ply != null && ply.Active)
|
||||
{
|
||||
if (displayIdsRequested)
|
||||
{
|
||||
players.Add(String.Format("{0} (ID: {1}{2})", ply.Name, ply.Index, ply.Account != null ? ", ID: " + ply.Account.ID : ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
players.Add(ply.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PaginationTools.SendPage(
|
||||
args.Player, pageNumber, PaginationTools.BuildLinesFromTerms(TShock.Utils.GetPlayers(displayIdsRequested)),
|
||||
args.Player, pageNumber, PaginationTools.BuildLinesFromTerms(players),
|
||||
new PaginationTools.Settings
|
||||
{
|
||||
IncludeHeader = false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue