From d90c42fd40e18ed19ab5d7270c6779f047f588f0 Mon Sep 17 00:00:00 2001 From: RedBurningPhoenix Date: Mon, 2 Sep 2024 23:48:06 +0500 Subject: [PATCH] AdminWho is back? --- .../Commands/AdminWhoCommand.cs | 40 ++++++++----------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/Content.Server/Administration/Commands/AdminWhoCommand.cs b/Content.Server/Administration/Commands/AdminWhoCommand.cs index cf2f8c453c..e1e271c38e 100644 --- a/Content.Server/Administration/Commands/AdminWhoCommand.cs +++ b/Content.Server/Administration/Commands/AdminWhoCommand.cs @@ -7,7 +7,7 @@ namespace Content.Server.Administration.Commands; -[AdminCommand(AdminFlags.Admin)] +[AnyCommand] public sealed class AdminWhoCommand : IConsoleCommand { public string Command => "adminwho"; @@ -19,42 +19,36 @@ public void Execute(IConsoleShell shell, string argStr, string[] args) var adminMgr = IoCManager.Resolve(); var afk = IoCManager.Resolve(); - var seeStealth = true; - - // If null it (hopefully) means it is being called from the console. - if (shell.Player != null) - { - var playerData = adminMgr.GetAdminData(shell.Player); - - seeStealth = playerData != null && playerData.CanStealth(); - } - var sb = new StringBuilder(); var first = true; + + // WD start + var isAdmin = shell.Player is {} player && adminMgr.HasAdminFlag(player, AdminFlags.Admin); foreach (var admin in adminMgr.ActiveAdmins) { - if (!first) - sb.Append('\n'); - first = false; - var adminData = adminMgr.GetAdminData(admin)!; DebugTools.AssertNotNull(adminData); - if (adminData.Stealth && !seeStealth) + if (!isAdmin && adminData.Stealth) continue; + if (!first) + sb.Append('\n'); + first = false; + sb.Append(admin.Name); if (adminData.Title is { } title) sb.Append($": [{title}]"); - if (adminData.Stealth) - sb.Append(" (S)"); + if (!isAdmin) + continue; - if (shell.Player is { } player && adminMgr.HasAdminFlag(player, AdminFlags.Admin)) - { - if (afk.IsAfk(admin)) - sb.Append(" [AFK]"); - } + if (afk.IsAfk(admin)) + sb.Append(" [AFK]"); + + if (adminData.Stealth) + sb.Append(" [Stealth]"); + // WD end } shell.WriteLine(sb.ToString());