@@ -8,32 +8,30 @@ using Robust.Shared.Utility;
|
||||
namespace Content.Server.Administration.Commands;
|
||||
|
||||
[AdminCommand(AdminFlags.AdminWho)]
|
||||
public sealed class AdminWhoCommand : IConsoleCommand
|
||||
public sealed class AdminWhoCommand : LocalizedCommands
|
||||
{
|
||||
public string Command => "adminwho";
|
||||
public string Description => "Returns a list of all admins on the server";
|
||||
public string Help => "Usage: adminwho";
|
||||
[Dependency] private readonly IAfkManager _afkManager = default!;
|
||||
[Dependency] private readonly IAdminManager _adminManager = default!;
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override string Command => "adminwho";
|
||||
|
||||
public override 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);
|
||||
var playerData = _adminManager.GetAdminData(shell.Player);
|
||||
|
||||
seeStealth = playerData != null && playerData.CanStealth();
|
||||
}
|
||||
|
||||
var sb = new StringBuilder();
|
||||
var first = true;
|
||||
foreach (var admin in adminMgr.ActiveAdmins)
|
||||
foreach (var admin in _adminManager.ActiveAdmins)
|
||||
{
|
||||
var adminData = adminMgr.GetAdminData(admin)!;
|
||||
var adminData = _adminManager.GetAdminData(admin)!;
|
||||
DebugTools.AssertNotNull(adminData);
|
||||
|
||||
if (adminData.Stealth && !seeStealth)
|
||||
@@ -50,9 +48,9 @@ public sealed class AdminWhoCommand : IConsoleCommand
|
||||
if (adminData.Stealth)
|
||||
sb.Append(" (S)");
|
||||
|
||||
if (shell.Player is { } player && adminMgr.HasAdminFlag(player, AdminFlags.Admin))
|
||||
if (shell.Player is { } player && _adminManager.HasAdminFlag(player, AdminFlags.Admin))
|
||||
{
|
||||
if (afk.IsAfk(admin))
|
||||
if (_afkManager.IsAfk(admin))
|
||||
sb.Append(" [AFK]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,26 +6,23 @@ using Robust.Shared.Console;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Moderator)]
|
||||
public sealed class AnnounceUiCommand : IConsoleCommand
|
||||
public sealed class AnnounceUiCommand : LocalizedEntityCommands
|
||||
{
|
||||
public string Command => "announceui";
|
||||
[Dependency] private readonly EuiManager _euiManager = default!;
|
||||
|
||||
public string Description => "Opens the announcement UI";
|
||||
public override string Command => "announceui";
|
||||
|
||||
public string Help => $"{Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player;
|
||||
if (player == null)
|
||||
{
|
||||
shell.WriteLine("This does not work from the server console.");
|
||||
shell.WriteLine(Loc.GetString($"shell-cannot-run-command-from-server"));
|
||||
return;
|
||||
}
|
||||
|
||||
var eui = IoCManager.Resolve<EuiManager>();
|
||||
var ui = new AdminAnnounceEui();
|
||||
eui.OpenEui(ui, player);
|
||||
_euiManager.OpenEui(ui, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,23 +7,22 @@ namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[AdminCommand(AdminFlags.None)]
|
||||
public sealed class DeAdminCommand : IConsoleCommand
|
||||
public sealed class DeAdminCommand : LocalizedCommands
|
||||
{
|
||||
public string Command => "deadmin";
|
||||
public string Description => "Temporarily de-admins you so you can experience the round as a normal player.";
|
||||
public string Help => "Usage: deadmin\nUse readmin to re-admin after using this.";
|
||||
[Dependency] private readonly IAdminManager _admin = default!;
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override string Command => "deadmin";
|
||||
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player;
|
||||
if (player == null)
|
||||
{
|
||||
shell.WriteLine("You cannot use this command from the server console.");
|
||||
shell.WriteLine(Loc.GetString($"shell-cannot-run-command-from-server"));
|
||||
return;
|
||||
}
|
||||
|
||||
var mgr = IoCManager.Resolve<IAdminManager>();
|
||||
mgr.DeAdmin(player);
|
||||
_admin.DeAdmin(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,42 +4,40 @@ using Robust.Shared.Console;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Spawn)]
|
||||
public sealed class DeleteComponent : IConsoleCommand
|
||||
public sealed class DeleteComponent : LocalizedEntityCommands
|
||||
{
|
||||
public string Command => "deletecomponent";
|
||||
public string Description => "Deletes all instances of the specified component.";
|
||||
public string Help => $"Usage: {Command} <name>";
|
||||
[Dependency] private readonly IComponentFactory _compFactory = default!;
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override string Command => "deletecomponent";
|
||||
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
switch (args.Length)
|
||||
{
|
||||
case 0:
|
||||
shell.WriteLine($"Not enough arguments.\n{Help}");
|
||||
shell.WriteLine(Loc.GetString($"shell-need-exactly-one-argument"));
|
||||
break;
|
||||
default:
|
||||
var name = string.Join(" ", args);
|
||||
var componentFactory = IoCManager.Resolve<IComponentFactory>();
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!componentFactory.TryGetRegistration(name, out var registration))
|
||||
if (!_compFactory.TryGetRegistration(name, out var registration))
|
||||
{
|
||||
shell.WriteLine($"No component exists with name {name}.");
|
||||
shell.WriteLine(Loc.GetString($"cmd-deletecomponent-no-component-exists", ("name", name)));
|
||||
break;
|
||||
}
|
||||
|
||||
var componentType = registration.Type;
|
||||
var components = entityManager.GetAllComponents(componentType, true);
|
||||
var components = EntityManager.GetAllComponents(componentType, true);
|
||||
|
||||
var i = 0;
|
||||
|
||||
foreach (var (uid, component) in components)
|
||||
{
|
||||
entityManager.RemoveComponent(uid, component);
|
||||
EntityManager.RemoveComponent(uid, component);
|
||||
i++;
|
||||
}
|
||||
|
||||
shell.WriteLine($"Removed {i} components with name {name}.");
|
||||
shell.WriteLine(Loc.GetString($"cmd-deletecomponent-success", ("count", i), ("name", name)));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -13,72 +13,73 @@ using Robust.Server.GameObjects;
|
||||
namespace Content.Server.Administration.Commands;
|
||||
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public sealed class OpenExplosionEui : IConsoleCommand
|
||||
public sealed class OpenExplosionEui : LocalizedEntityCommands
|
||||
{
|
||||
public string Command => "explosionui";
|
||||
public string Description => "Opens a window for easy access to station destruction";
|
||||
public string Help => $"Usage: {Command}";
|
||||
[Dependency] private readonly EuiManager _euiManager = default!;
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override string Command => "explosionui";
|
||||
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player;
|
||||
if (player == null)
|
||||
{
|
||||
shell.WriteError("This does not work from the server console.");
|
||||
shell.WriteError(Loc.GetString($"shell-cannot-run-command-from-server"));
|
||||
return;
|
||||
}
|
||||
|
||||
var eui = IoCManager.Resolve<EuiManager>();
|
||||
var ui = new SpawnExplosionEui();
|
||||
eui.OpenEui(ui, player);
|
||||
_euiManager.OpenEui(ui, player);
|
||||
}
|
||||
}
|
||||
|
||||
[AdminCommand(AdminFlags.Fun)] // for the admin. Not so much for anyone else.
|
||||
public sealed class ExplosionCommand : IConsoleCommand
|
||||
public sealed class ExplosionCommand : LocalizedEntityCommands
|
||||
{
|
||||
public string Command => "explosion";
|
||||
public string Description => "Train go boom";
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly ExplosionSystem _explosion = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
public override string Command => "explosion";
|
||||
|
||||
// Note that if you change the arguments, you should also update the client-side SpawnExplosionWindow, as that just
|
||||
// uses this command.
|
||||
public string Help => "Usage: explosion [intensity] [slope] [maxIntensity] [x y] [mapId] [prototypeId]";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length == 0 || args.Length == 4 || args.Length > 7)
|
||||
{
|
||||
shell.WriteError("Wrong number of arguments.");
|
||||
shell.WriteError(Loc.GetString($"shell-wrong-arguments-number"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!float.TryParse(args[0], out var intensity))
|
||||
{
|
||||
shell.WriteError($"Failed to parse intensity: {args[0]}");
|
||||
shell.WriteError(Loc.GetString($"cmd-explosion-failed-to-parse-intensity", ("value", args[0])));
|
||||
return;
|
||||
}
|
||||
|
||||
float slope = 5;
|
||||
if (args.Length > 1 && !float.TryParse(args[1], out slope))
|
||||
{
|
||||
shell.WriteError($"Failed to parse float: {args[1]}");
|
||||
shell.WriteError(Loc.GetString($"cmd-explosion-failed-to-parse-float", ("value", args[1])));
|
||||
return;
|
||||
}
|
||||
|
||||
float maxIntensity = 100;
|
||||
if (args.Length > 2 && !float.TryParse(args[2], out maxIntensity))
|
||||
{
|
||||
shell.WriteError($"Failed to parse float: {args[2]}");
|
||||
shell.WriteError(Loc.GetString($"cmd-explosion-failed-to-parse-float", ("value", args[2])));
|
||||
return;
|
||||
}
|
||||
|
||||
float x = 0, y = 0;
|
||||
if (args.Length > 4)
|
||||
{
|
||||
if (!float.TryParse(args[3], out x) ||
|
||||
!float.TryParse(args[4], out y))
|
||||
if (!float.TryParse(args[3], out x) || !float.TryParse(args[4], out y))
|
||||
{
|
||||
shell.WriteError($"Failed to parse coordinates: {(args[3], args[4])}");
|
||||
shell.WriteError(Loc.GetString($"cmd-explosion-failed-to-parse-coords",
|
||||
("value1", args[3]),
|
||||
("value2", args[4])));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -88,7 +89,7 @@ public sealed class ExplosionCommand : IConsoleCommand
|
||||
{
|
||||
if (!int.TryParse(args[5], out var parsed))
|
||||
{
|
||||
shell.WriteError($"Failed to parse map ID: {args[5]}");
|
||||
shell.WriteError(Loc.GetString($"cmd-explosion-failed-to-parse-map-id", ("value", args[5])));
|
||||
return;
|
||||
}
|
||||
coords = new MapCoordinates(new Vector2(x, y), new(parsed));
|
||||
@@ -96,42 +97,39 @@ public sealed class ExplosionCommand : IConsoleCommand
|
||||
else
|
||||
{
|
||||
// attempt to find the player's current position
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entMan.TryGetComponent(shell.Player?.AttachedEntity, out TransformComponent? xform))
|
||||
if (!EntityManager.TryGetComponent(shell.Player?.AttachedEntity, out TransformComponent? xform))
|
||||
{
|
||||
shell.WriteError($"Failed get default coordinates/map via player's transform. Need to specify explicitly.");
|
||||
shell.WriteError(Loc.GetString($"cmd-explosion-need-coords-explicit"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length > 4)
|
||||
coords = new MapCoordinates(new Vector2(x, y), xform.MapID);
|
||||
else
|
||||
coords = entMan.System<TransformSystem>().GetMapCoordinates(shell.Player.AttachedEntity.Value, xform: xform);
|
||||
coords = _transform.GetMapCoordinates(shell.Player.AttachedEntity.Value, xform: xform);
|
||||
}
|
||||
|
||||
ExplosionPrototype? type;
|
||||
var protoMan = IoCManager.Resolve<IPrototypeManager>();
|
||||
if (args.Length > 6)
|
||||
{
|
||||
if (!protoMan.TryIndex(args[6], out type))
|
||||
if (!_prototypeManager.TryIndex(args[6], out type))
|
||||
{
|
||||
shell.WriteError($"Unknown explosion prototype: {args[6]}");
|
||||
shell.WriteError(Loc.GetString($"cmd-explosion-unknown-prototype", ("value", args[6])));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!protoMan.TryIndex(ExplosionSystem.DefaultExplosionPrototypeId, out type))
|
||||
else if (!_prototypeManager.TryIndex(ExplosionSystem.DefaultExplosionPrototypeId, out type))
|
||||
{
|
||||
// no prototype was specified, so lets default to whichever one was defined first
|
||||
type = protoMan.EnumeratePrototypes<ExplosionPrototype>().FirstOrDefault();
|
||||
type = _prototypeManager.EnumeratePrototypes<ExplosionPrototype>().FirstOrDefault();
|
||||
|
||||
if (type == null)
|
||||
{
|
||||
shell.WriteError($"Prototype manager has no explosion prototypes?");
|
||||
shell.WriteError(Loc.GetString($"cmd-explosion-no-prototypes"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var sysMan = IoCManager.Resolve<IEntitySystemManager>();
|
||||
sysMan.GetEntitySystem<ExplosionSystem>().QueueExplosion(coords, type.ID, intensity, slope, maxIntensity, null);
|
||||
_explosion.QueueExplosion(coords, type.ID, intensity, slope, maxIntensity, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,13 @@ using Robust.Shared.Console;
|
||||
namespace Content.Server.Administration.Commands;
|
||||
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public sealed class FaxUiCommand : IConsoleCommand
|
||||
public sealed class FaxUiCommand : LocalizedEntityCommands
|
||||
{
|
||||
public string Command => "faxui";
|
||||
[Dependency] private readonly EuiManager _euiManager = default!;
|
||||
|
||||
public string Description => Loc.GetString("cmd-faxui-desc");
|
||||
public string Help => Loc.GetString("cmd-faxui-help");
|
||||
public override string Command => "faxui";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (shell.Player is not { } player)
|
||||
{
|
||||
@@ -21,8 +20,7 @@ public sealed class FaxUiCommand : IConsoleCommand
|
||||
return;
|
||||
}
|
||||
|
||||
var eui = IoCManager.Resolve<EuiManager>();
|
||||
var ui = new AdminFaxEui();
|
||||
eui.OpenEui(ui, player);
|
||||
_euiManager.OpenEui(ui, player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,35 +3,29 @@ using Content.Server.GameTicking;
|
||||
using Content.Server.Maps;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.EntitySerialization;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Round | AdminFlags.Spawn)]
|
||||
public sealed class LoadGameMapCommand : IConsoleCommand
|
||||
public sealed class LoadGameMapCommand : LocalizedEntityCommands
|
||||
{
|
||||
public string Command => "loadgamemap";
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly GameTicker _gameTicker = default!;
|
||||
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||
|
||||
public string Description => "Loads the given game map at the given coordinates.";
|
||||
public override string Command => "loadgamemap";
|
||||
|
||||
public string Help => "loadgamemap <mapid> <gamemap> [<x> <y> [<name>]] ";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var gameTicker = entityManager.EntitySysManager.GetEntitySystem<GameTicker>();
|
||||
var mapSys = entityManager.EntitySysManager.GetEntitySystem<SharedMapSystem>();
|
||||
|
||||
if (args.Length is not (2 or 4 or 5))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("shell-wrong-arguments-number"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!prototypeManager.TryIndex<GameMapPrototype>(args[1], out var gameMap))
|
||||
if (!_prototypeManager.TryIndex<GameMapPrototype>(args[1], out var gameMap))
|
||||
{
|
||||
shell.WriteError($"The given map prototype {args[0]} is invalid.");
|
||||
return;
|
||||
@@ -48,14 +42,14 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
var id = new MapId(mapId);
|
||||
|
||||
var grids = mapSys.MapExists(id)
|
||||
? gameTicker.MergeGameMap(gameMap, id, stationName: stationName, offset: offset)
|
||||
: gameTicker.LoadGameMapWithId(gameMap, id, stationName: stationName, offset: offset);
|
||||
var grids = _mapSystem.MapExists(id)
|
||||
? _gameTicker.MergeGameMap(gameMap, id, stationName: stationName, offset: offset)
|
||||
: _gameTicker.LoadGameMapWithId(gameMap, id, stationName: stationName, offset: offset);
|
||||
|
||||
shell.WriteLine($"Loaded {grids.Count} grids.");
|
||||
}
|
||||
|
||||
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||
{
|
||||
switch (args.Length)
|
||||
{
|
||||
@@ -79,26 +73,20 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
|
||||
[AdminCommand(AdminFlags.Round | AdminFlags.Spawn)]
|
||||
public sealed class ListGameMaps : IConsoleCommand
|
||||
public sealed class ListGameMaps : LocalizedCommands
|
||||
{
|
||||
public string Command => "listgamemaps";
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
public string Description => "Lists the game maps that can be used by loadgamemap";
|
||||
public override string Command => "listgamemaps";
|
||||
|
||||
public string Help => "listgamemaps";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var gameTicker = entityManager.EntitySysManager.GetEntitySystem<GameTicker>();
|
||||
|
||||
if (args.Length != 0)
|
||||
{
|
||||
shell.WriteError(Loc.GetString("shell-wrong-arguments-number"));
|
||||
return;
|
||||
}
|
||||
foreach (var prototype in prototypeManager.EnumeratePrototypes<GameMapPrototype>())
|
||||
foreach (var prototype in _prototypeManager.EnumeratePrototypes<GameMapPrototype>())
|
||||
{
|
||||
shell.WriteLine($"{prototype.ID} - {prototype.MapName}");
|
||||
}
|
||||
|
||||
@@ -6,13 +6,13 @@ using Robust.Shared.Console;
|
||||
namespace Content.Server.Administration.Commands;
|
||||
|
||||
[AdminCommand(AdminFlags.Logs)]
|
||||
public sealed class OpenAdminLogsCommand : IConsoleCommand
|
||||
public sealed class OpenAdminLogsCommand : LocalizedEntityCommands
|
||||
{
|
||||
public string Command => "adminlogs";
|
||||
public string Description => "Opens the admin logs panel.";
|
||||
public string Help => $"Usage: {Command}";
|
||||
[Dependency] private readonly EuiManager _euiManager = default!;
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override string Command => "adminlogs";
|
||||
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (shell.Player is not { } player)
|
||||
{
|
||||
@@ -20,8 +20,7 @@ public sealed class OpenAdminLogsCommand : IConsoleCommand
|
||||
return;
|
||||
}
|
||||
|
||||
var eui = IoCManager.Resolve<EuiManager>();
|
||||
var ui = new AdminLogsEui();
|
||||
eui.OpenEui(ui, player);
|
||||
_euiManager.OpenEui(ui, player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,24 +6,23 @@ using Robust.Shared.Console;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Permissions)]
|
||||
public sealed class OpenPermissionsCommand : IConsoleCommand
|
||||
public sealed class OpenPermissionsCommand : LocalizedEntityCommands
|
||||
{
|
||||
public string Command => "permissions";
|
||||
public string Description => "Opens the admin permissions panel.";
|
||||
public string Help => "Usage: permissions";
|
||||
[Dependency] private readonly EuiManager _euiManager = default!;
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override string Command => "permissions";
|
||||
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player;
|
||||
if (player == null)
|
||||
{
|
||||
shell.WriteLine("This does not work from the server console.");
|
||||
shell.WriteLine(Loc.GetString($"shell-cannot-run-command-from-server"));
|
||||
return;
|
||||
}
|
||||
|
||||
var eui = IoCManager.Resolve<EuiManager>();
|
||||
var ui = new PermissionsEui();
|
||||
eui.OpenEui(ui, player);
|
||||
_euiManager.OpenEui(ui, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
using System.Text;
|
||||
using Content.Server.Database;
|
||||
using Content.Server.Database;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Ban)]
|
||||
public sealed class PardonCommand : IConsoleCommand
|
||||
public sealed class PardonCommand : LocalizedCommands
|
||||
{
|
||||
public string Command => "pardon";
|
||||
public string Description => "Pardons somebody's ban";
|
||||
public string Help => $"Usage: {Command} <ban id>";
|
||||
[Dependency] private readonly IServerDbManager _dbManager = default!;
|
||||
|
||||
public async void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override string Command => "pardon";
|
||||
|
||||
public override async void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player;
|
||||
var dbMan = IoCManager.Resolve<IServerDbManager>();
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
@@ -25,11 +23,11 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (!int.TryParse(args[0], out var banId))
|
||||
{
|
||||
shell.WriteLine($"Unable to parse {args[0]} as a ban id integer.\n{Help}");
|
||||
shell.WriteLine(Loc.GetString($"cmd-pardon-unable-to-parse", ("id", args[0]), ("help", Help)));
|
||||
return;
|
||||
}
|
||||
|
||||
var ban = await dbMan.GetServerBanAsync(banId);
|
||||
var ban = await _dbManager.GetServerBanAsync(banId);
|
||||
|
||||
if (ban == null)
|
||||
{
|
||||
@@ -39,22 +37,22 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (ban.Unban != null)
|
||||
{
|
||||
var response = new StringBuilder("This ban has already been pardoned");
|
||||
|
||||
if (ban.Unban.UnbanningAdmin != null)
|
||||
{
|
||||
response.Append($" by {ban.Unban.UnbanningAdmin.Value}");
|
||||
shell.WriteLine(Loc.GetString($"cmd-pardon-already-pardoned-specific",
|
||||
("admin", ban.Unban.UnbanningAdmin.Value),
|
||||
("time", ban.Unban.UnbanTime)));
|
||||
}
|
||||
|
||||
response.Append($" in {ban.Unban.UnbanTime}.");
|
||||
else
|
||||
shell.WriteLine(Loc.GetString($"cmd-pardon-already-pardoned"));
|
||||
|
||||
shell.WriteLine(response.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
await dbMan.AddServerUnbanAsync(new ServerUnbanDef(banId, player?.UserId, DateTimeOffset.Now));
|
||||
await _dbManager.AddServerUnbanAsync(new ServerUnbanDef(banId, player?.UserId, DateTimeOffset.Now));
|
||||
|
||||
shell.WriteLine($"Pardoned ban with id {banId}");
|
||||
shell.WriteLine(Loc.GetString($"cmd-pardon-success", ("id", banId)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,3 +6,6 @@ admin-announce-button = Announce
|
||||
admin-announce-type-station = Station
|
||||
admin-announce-type-server = Server
|
||||
admin-announce-keep-open = Keep open
|
||||
|
||||
cmd-announceui-desc = Opens the announcement UI.
|
||||
cmd-announceui-help = Usage: announceui
|
||||
|
||||
@@ -14,3 +14,16 @@ admin-explosion-eui-label-angle = Angle
|
||||
admin-explosion-eui-label-spread = Spread
|
||||
admin-explosion-eui-label-distance = Distance
|
||||
admin-explosion-eui-label-spawn = Kabloom!
|
||||
|
||||
cmd-explosionui-desc = Opens a window for easy access to station destruction.
|
||||
cmd-explosionui-help = Usage: explosionui
|
||||
|
||||
cmd-explosion-desc = Train go boom
|
||||
cmd-explosion-help = Usage: explosion [intensity] [slope] [maxIntensity] [x y] [mapId] [prototypeId]
|
||||
cmd-explosion-failed-to-parse-intensity = Failed to parse intensity: {$value}
|
||||
cmd-explosion-failed-to-parse-float = Failed to parse float: {$value}
|
||||
cmd-explosion-failed-to-parse-coords = Failed to parse coordinates: {$value1} {$value2}
|
||||
cmd-explosion-failed-to-parse-map-id = Failed to parse map ID: {$value}
|
||||
cmd-explosion-need-coords-explicit = Failed get default coordinates/map via player's transform. Need to specify explicitly.
|
||||
cmd-explosion-unknown-prototype = Unknown explosion prototype: {$value}
|
||||
cmd-explosion-no-prototypes = Prototype manager has no explosion prototypes?
|
||||
|
||||
@@ -21,3 +21,6 @@ permissions-eui-edit-admin-rank-button = Edit
|
||||
permissions-eui-edit-admin-rank-window-title = Edit Admin Rank
|
||||
permissions-eui-edit-admin-window-save-button = Save
|
||||
permissions-eui-edit-admin-window-remove-flag-button = Remove
|
||||
|
||||
cmd-permissions-desc = Opens the admin permissions panel.
|
||||
cmd-permissions-help = Usage: permissions
|
||||
|
||||
2
Resources/Locale/en-US/commands/admin-logs-command.ftl
Normal file
2
Resources/Locale/en-US/commands/admin-logs-command.ftl
Normal file
@@ -0,0 +1,2 @@
|
||||
cmd-adminlogs-desc = Opens the admin logs panel.
|
||||
cmd-adminlogs-help = Usage: adminlogs
|
||||
2
Resources/Locale/en-US/commands/admin-who-command.ftl
Normal file
2
Resources/Locale/en-US/commands/admin-who-command.ftl
Normal file
@@ -0,0 +1,2 @@
|
||||
cmd-adminwho-desc = Returns a list of all admins on the server.
|
||||
cmd-adminwho-help = Usage: adminwho
|
||||
3
Resources/Locale/en-US/commands/deadmin-command.ftl
Normal file
3
Resources/Locale/en-US/commands/deadmin-command.ftl
Normal file
@@ -0,0 +1,3 @@
|
||||
cmd-deadmin-desc = Temporarily de-admins you so you can experience the round as a normal player.
|
||||
cmd-deadmin-help = Usage: deadmin
|
||||
Use readmin to re-admin after using this.
|
||||
@@ -0,0 +1,4 @@
|
||||
cmd-deletecomponent-desc = Deletes all instances of the specified component.
|
||||
cmd-deletecomponent-help = Usage: deletecomponent <name>"
|
||||
cmd-deletecomponent-no-component-exists = No component exists with name {$name}.
|
||||
cmd-deletecomponent-success = Removed {$count} components with name {$name}.
|
||||
5
Resources/Locale/en-US/commands/map-commands.ftl
Normal file
5
Resources/Locale/en-US/commands/map-commands.ftl
Normal file
@@ -0,0 +1,5 @@
|
||||
cmd-loadgamemap-desc = Loads the given game map at the given coordinates.
|
||||
cmd-loadgamemap-help = loadgamemap <mapid> <gamemap> [<x> <y> [<name>]]
|
||||
|
||||
cmd-listgamemaps-desc = Lists the game maps that can be used by loadgamemap.
|
||||
cmd-listgamemaps-help = Usage: listgamemaps
|
||||
7
Resources/Locale/en-US/commands/pardon-command.ftl
Normal file
7
Resources/Locale/en-US/commands/pardon-command.ftl
Normal file
@@ -0,0 +1,7 @@
|
||||
cmd-pardon-desc = Pardon somebody's ban.
|
||||
cmd-pardon-help = Usage: pardon <ban id>
|
||||
cmd-pardon-unable-to-parse = Unable to parse {$id} as a ban id integer.
|
||||
{$help}
|
||||
cmd-pardon-already-pardoned = This ban has already been pardoned.
|
||||
cmd-pardon-already-pardoned-specific = This ban has already been pardoned by {$admin} in {$time}.
|
||||
cmd-pardon-success = Pardoned ban with id {$id}.
|
||||
Reference in New Issue
Block a user