Fix openahelp and quit command perms (#5763)

Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2021-12-13 16:45:49 +11:00
committed by GitHub
parent 2d773fa983
commit f110e28021
15 changed files with 27 additions and 2 deletions

View File

@@ -1,10 +1,13 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Content.Shared.Administration;
using Robust.Client.Console;
using Robust.Shared.Console;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Network;
using Robust.Shared.Reflection;
namespace Content.Client.Administration.Managers
{
@@ -61,6 +64,15 @@ namespace Content.Client.Administration.Managers
private void UpdateMessageRx(MsgUpdateAdminStatus message)
{
_availableCommands.Clear();
var host = IoCManager.Resolve<IClientConsoleHost>();
// Anything marked as Any we'll just add even if the server doesn't know about it.
foreach (var (command, instance) in host.RegisteredCommands)
{
if (Attribute.GetCustomAttribute(instance.GetType(), typeof(AnyCommandAttribute)) == null) continue;
_availableCommands.Add(command);
}
_availableCommands.UnionWith(message.AvailableCommands);
Logger.DebugS("admin", $"Have {message.AvailableCommands.Length} commands available");