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-11 01:13:03 -08:00
|
|
|
using Robust.Server.Player;
|
2021-02-01 16:49:43 -08:00
|
|
|
using Robust.Shared.Console;
|
2020-10-30 16:06:48 +01:00
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
|
|
|
|
|
2020-11-10 21:30:20 +01:00
|
|
|
namespace Content.Server.Administration.Commands
|
2020-10-30 16:06:48 +01:00
|
|
|
{
|
|
|
|
|
[AnyCommand]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class ReAdminCommand : IConsoleCommand
|
2020-10-30 16:06:48 +01:00
|
|
|
{
|
|
|
|
|
public string Command => "readmin";
|
|
|
|
|
public string Description => "Re-admins you if you previously de-adminned.";
|
|
|
|
|
public string Help => "Usage: readmin";
|
|
|
|
|
|
2021-02-01 16:49:43 -08:00
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
2020-10-30 16:06:48 +01:00
|
|
|
{
|
2021-02-01 16:49:43 -08:00
|
|
|
var player = shell.Player as IPlayerSession;
|
2020-10-30 16:06:48 +01:00
|
|
|
if (player == null)
|
|
|
|
|
{
|
2021-02-01 16:49:43 -08:00
|
|
|
shell.WriteLine("You cannot use this command from the server console.");
|
2020-10-30 16:06:48 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var mgr = IoCManager.Resolve<IAdminManager>();
|
|
|
|
|
|
|
|
|
|
if (mgr.GetAdminData(player, includeDeAdmin: true) == null)
|
|
|
|
|
{
|
2021-02-01 16:49:43 -08:00
|
|
|
shell.WriteLine("You're not an admin.");
|
2020-10-30 16:06:48 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mgr.ReAdmin(player);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|