Skip to content

Commit

Permalink
Make /clients use MessageLines and display num unique clients connected
Browse files Browse the repository at this point in the history
  • Loading branch information
Goodlyay committed Aug 7, 2024
1 parent 9046849 commit 7f01f7f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions MCGalaxy/Commands/Information/CmdPClients.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public override void Use(Player p, string message, CommandData data) {
usingClient.Add(pl);
}

p.Message("Players using:");
List<string> lines = new List<string>();
lines.Add("Players using:");
foreach (var kvp in clients)
{
StringBuilder builder = new StringBuilder();
Expand All @@ -57,8 +58,10 @@ public override void Use(Player p, string message, CommandData data) {
builder.Append(nick);
if (i < players.Count - 1) builder.Append(", ");
}
p.Message(" {0}: &f{1}", kvp.Key, builder.ToString());
lines.Add(string.Format(" {0}: &f{1}", kvp.Key, builder.ToString()));
}
lines.Add(string.Format("Displayed {0} unique client name{1}.", clients.Count, clients.Count == 1 ? "" : "s"));
p.MessageLines(lines);
}

public override void Help(Player p) {
Expand Down

0 comments on commit 7f01f7f

Please sign in to comment.