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");

View File

@@ -1,5 +1,6 @@
using System;
using Content.Client.Administration;
using Content.Shared.Administration;
using Robust.Client.Console;
using Robust.Client.GameObjects;
using Robust.Shared.Console;
@@ -10,6 +11,7 @@ using Robust.Shared.IoC;
namespace Content.Client.Commands
{
[AnyCommand]
public class OpenAHelpCommand : IConsoleCommand
{
public string Command => "openahelp";

View File

@@ -1,4 +1,5 @@
using Content.Server.Administration.Managers;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.IoC;

View File

@@ -1,6 +1,7 @@
using Content.Server.Administration;
using Content.Server.Chat.Managers;
using Content.Server.Players;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Enums;

View File

@@ -1,5 +1,6 @@
using Content.Server.Administration;
using Content.Server.Chat.Managers;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.IoC;

View File

@@ -2,6 +2,7 @@ using Content.Server.Administration;
using Content.Server.Chat.Managers;
using Content.Server.Ghost.Components;
using Content.Server.Players;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Enums;

View File

@@ -8,6 +8,7 @@ using Content.Server.Hands.Components;
using Content.Server.Items;
using Content.Server.Players;
using Content.Server.Popups;
using Content.Shared.Administration;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Database;

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using Content.Server.Administration;
using Content.Server.Roles;
using Content.Server.Station;
using Content.Shared.Administration;
using Content.Shared.Roles;
using Content.Shared.Station;
using Robust.Server.Player;

View File

@@ -1,4 +1,5 @@
using Content.Server.Administration;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;

View File

@@ -1,4 +1,5 @@
using Content.Server.Administration;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;

View File

@@ -1,6 +1,7 @@
using Content.Server.Administration;
using Content.Server.GameTicking;
using Content.Server.Players;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;

View File

@@ -5,6 +5,7 @@ using Content.Server.Ghost.Components;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Ghost.Roles.UI;
using Content.Server.Players;
using Content.Shared.Administration;
using Content.Shared.GameTicking;
using Content.Shared.Ghost;
using Content.Shared.Ghost.Roles;

View File

@@ -1,4 +1,5 @@
using Content.Server.Administration;
using Content.Shared.Administration;
using Robust.Shared.Console;
using Robust.Shared.Localization;

View File

@@ -2,12 +2,11 @@
using JetBrains.Annotations;
using Robust.Shared.Console;
namespace Content.Server.Administration
namespace Content.Shared.Administration
{
/// <summary>
/// Specifies that a command can be executed by any player.
/// </summary>
/// <seealso cref="AdminCommandAttribute"/>
[AttributeUsage(AttributeTargets.Class)]
[BaseTypeRequired(typeof(IConsoleCommand))]
[MeansImplicitUse]

View File

@@ -3,6 +3,7 @@
- disconnect
- help
- list
- quit
- Flags: VAREDIT
Commands: