Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tweak] Adminwho Command #40

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 17 additions & 23 deletions Content.Server/Administration/Commands/AdminWhoCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Content.Server.Administration.Commands;

[AdminCommand(AdminFlags.Admin)]
[AnyCommand]
public sealed class AdminWhoCommand : IConsoleCommand
{
public string Command => "adminwho";
Expand All @@ -19,42 +19,36 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
var adminMgr = IoCManager.Resolve<IAdminManager>();
var afk = IoCManager.Resolve<IAfkManager>();

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]");
PuroSlavKing marked this conversation as resolved.
Show resolved Hide resolved

if (adminData.Stealth)
sb.Append(" [Stealth]");
Comment on lines +49 to +50
Copy link

@misandrie misandrie Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Задумка стелса также прятаться от других педалей у которых этого флага нет.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А как это поможет, если ты в Ахелпе так и так видишь кто сейчас на сервере.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Оно показывается какбудто ты деадминнут

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так Агоста и так видно...
Не панацея.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так Агоста и так видно... Не панацея.

Всё скрываемо

почти

// WD end
}

shell.WriteLine(sb.ToString());
Expand Down
Loading