2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Administration.Managers;
|
2021-12-13 16:45:49 +11:00
|
|
|
using Content.Shared.Administration;
|
2021-02-01 16:49:43 -08:00
|
|
|
using Robust.Shared.Console;
|
2020-10-30 16:06:48 +01:00
|
|
|
|
2020-11-10 21:30:20 +01:00
|
|
|
namespace Content.Server.Administration.Commands
|
2020-10-30 16:06:48 +01:00
|
|
|
{
|
|
|
|
|
[AnyCommand]
|
2025-06-17 16:49:58 -04:00
|
|
|
public sealed class ReAdminCommand : LocalizedCommands
|
2020-10-30 16:06:48 +01:00
|
|
|
{
|
2025-06-17 16:49:58 -04:00
|
|
|
[Dependency] private readonly IAdminManager _adminManager = default!;
|
2020-10-30 16:06:48 +01:00
|
|
|
|
2025-06-17 16:49:58 -04:00
|
|
|
public override string Command => "readmin";
|
|
|
|
|
|
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
2020-10-30 16:06:48 +01:00
|
|
|
{
|
2023-10-28 09:59:53 +11:00
|
|
|
var player = shell.Player;
|
2020-10-30 16:06:48 +01:00
|
|
|
if (player == null)
|
|
|
|
|
{
|
2025-06-17 16:49:58 -04:00
|
|
|
shell.WriteLine(Loc.GetString($"shell-cannot-run-command-from-server"));
|
2020-10-30 16:06:48 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-17 16:49:58 -04:00
|
|
|
if (_adminManager.GetAdminData(player, includeDeAdmin: true) == null)
|
2020-10-30 16:06:48 +01:00
|
|
|
{
|
2025-06-17 16:49:58 -04:00
|
|
|
shell.WriteLine(Loc.GetString($"cmd-readmin-not-an-admin"));
|
2020-10-30 16:06:48 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-17 16:49:58 -04:00
|
|
|
_adminManager.ReAdmin(player);
|
2020-10-30 16:06:48 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|