ReAdminCommand.cs 1017 B

12345678910111213141516171819202122232425262728293031323334
  1. using Content.Server.Administration.Managers;
  2. using Content.Shared.Administration;
  3. using Robust.Shared.Console;
  4. namespace Content.Server.Administration.Commands
  5. {
  6. [AnyCommand]
  7. public sealed class ReAdminCommand : IConsoleCommand
  8. {
  9. public string Command => "readmin";
  10. public string Description => "Re-admins you if you previously de-adminned.";
  11. public string Help => "Usage: readmin";
  12. public void Execute(IConsoleShell shell, string argStr, string[] args)
  13. {
  14. var player = shell.Player;
  15. if (player == null)
  16. {
  17. shell.WriteLine("You cannot use this command from the server console.");
  18. return;
  19. }
  20. var mgr = IoCManager.Resolve<IAdminManager>();
  21. if (mgr.GetAdminData(player, includeDeAdmin: true) == null)
  22. {
  23. shell.WriteLine("You're not an admin.");
  24. return;
  25. }
  26. mgr.ReAdmin(player);
  27. }
  28. }
  29. }