Files
tbd-station-14/Content.Server/Toolshed/Commands/AdminDebug/ACmdCommand.cs
Leon Friedrich 06e2bba8ab Toolshed refactor (#33598)
* Content changes for engine toolshed PR

* add contains command

* more permissive commands
2024-12-21 17:45:48 +11:00

31 lines
1.0 KiB
C#

using Content.Server.Administration;
using Content.Server.Administration.Managers;
using Content.Shared.Administration;
using Robust.Shared.Player;
using Robust.Shared.Toolshed;
using Robust.Shared.Toolshed.Syntax;
namespace Content.Server.Toolshed.Commands.AdminDebug;
[ToolshedCommand, AdminCommand(AdminFlags.Debug)]
public sealed class ACmdCommand : ToolshedCommand
{
[Dependency] private readonly IAdminManager _adminManager = default!;
[CommandImplementation("perms")]
public AdminFlags[]? Perms([PipedArgument] CommandSpec command)
{
var res = _adminManager.TryGetCommandFlags(command, out var flags);
if (res)
flags ??= Array.Empty<AdminFlags>();
return flags;
}
[CommandImplementation("caninvoke")]
public bool CanInvoke(IInvocationContext ctx, [PipedArgument] CommandSpec command, ICommonSession player)
{
// Deliberately discard the error.
return ((IPermissionController) _adminManager).CheckInvokable(command, player, out _);
}
}