mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
33 lines
1 KiB
C#
33 lines
1 KiB
C#
using Content.Server.Administration.Managers;
|
|
using JetBrains.Annotations;
|
|
using Robust.Server.Player;
|
|
using Robust.Shared.Console;
|
|
|
|
namespace Content.Server.Administration.Commands
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed partial class PromoteHostCommand : LocalizedCommands
|
|
{
|
|
[Dependency] private IAdminManager _adminManager = default!;
|
|
[Dependency] private IPlayerManager _playerManager = default!;
|
|
|
|
public override string Command => "promotehost";
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
if (args.Length != 1)
|
|
{
|
|
shell.WriteLine(Loc.GetString($"shell-need-exactly-one-argument"));
|
|
return;
|
|
}
|
|
|
|
if (!_playerManager.TryGetSessionByUsername(args[0], out var targetPlayer))
|
|
{
|
|
shell.WriteLine(Loc.GetString($"shell-target-player-does-not-exist"));
|
|
return;
|
|
}
|
|
|
|
_adminManager.PromoteHost(targetPlayer);
|
|
}
|
|
}
|
|
}
|