diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs
index ffea76db..ee85a62a 100644
--- a/TShockAPI/Commands.cs
+++ b/TShockAPI/Commands.cs
@@ -2636,7 +2636,10 @@ namespace TShockAPI
private static void Playing(CommandArgs args)
{
- args.Player.SendMessage(string.Format("Current players: {0}.", TShock.Utils.GetPlayers()), 255, 240, 20);
+ string response = args.Player.Group.HasPermission(Permissions.seeids)
+ ? TShock.Utils.GetPlayersWithIds()
+ : TShock.Utils.GetPlayers();
+ args.Player.SendMessage(string.Format("Current players: {0}.", response), 255, 240, 20);
args.Player.SendMessage(string.Format("TShock: {0} ({1}): ({2}/{3})", TShock.VersionNum, TShock.VersionCodename,
TShock.Utils.ActivePlayers(), TShock.Config.MaxSlots));
}
diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs
index 97d6e7e4..fb79bdca 100644
--- a/TShockAPI/Permissions.cs
+++ b/TShockAPI/Permissions.cs
@@ -158,7 +158,10 @@ namespace TShockAPI
[Description("User can start invasions (Goblin/Snow Legion) using items")]
public static readonly string startinvasion;
- static Permissions()
+ [Description("User can see the id of players with /who")]
+ public static readonly string seeids;
+
+ static Permissions()
{
foreach (var field in typeof (Permissions).GetFields())
{
diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs
index 05579b95..d5c723b9 100644
--- a/TShockAPI/Utils.cs
+++ b/TShockAPI/Utils.cs
@@ -69,6 +69,29 @@ namespace TShockAPI
return sb.ToString();
}
+ ///
+ /// Used for some places where a list of players might be used.
+ ///
+ /// String of players and their id seperated by commas.
+ public string GetPlayersWithIds()
+ {
+ var sb = new StringBuilder();
+ foreach (TSPlayer player in TShock.Players)
+ {
+ if (player != null && player.Active)
+ {
+ if (sb.Length != 0)
+ {
+ sb.Append(", ");
+ }
+ sb.Append(player.Name);
+ string id = "( " + Convert.ToString(TShock.Users.GetUserID(player.UserAccountName)) + " )";
+ sb.Append(id);
+ }
+ }
+ return sb.ToString();
+ }
+
///
/// Finds a player and gets IP as string
///