2021-07-17 02:37:09 +02:00
|
|
|
|
using Content.Server.Administration.Managers;
|
2020-12-23 16:24:05 +01:00
|
|
|
|
using JetBrains.Annotations;
|
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-12-23 16:24:05 +01:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Administration.Commands
|
|
|
|
|
|
{
|
|
|
|
|
|
[UsedImplicitly]
|
2025-06-17 16:49:58 -04:00
|
|
|
|
public sealed class PromoteHostCommand : LocalizedCommands
|
2020-12-23 16:24:05 +01:00
|
|
|
|
{
|
2025-06-17 16:49:58 -04:00
|
|
|
|
[Dependency] private readonly IAdminManager _adminManager = default!;
|
|
|
|
|
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
2020-12-23 16:24:05 +01:00
|
|
|
|
|
2025-06-17 16:49:58 -04:00
|
|
|
|
public override string Command => "promotehost";
|
|
|
|
|
|
|
|
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
2020-12-23 16:24:05 +01:00
|
|
|
|
{
|
|
|
|
|
|
if (args.Length != 1)
|
|
|
|
|
|
{
|
2025-06-17 16:49:58 -04:00
|
|
|
|
shell.WriteLine(Loc.GetString($"shell-need-exactly-one-argument"));
|
2020-12-23 16:24:05 +01:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-17 16:49:58 -04:00
|
|
|
|
if (!_playerManager.TryGetSessionByUsername(args[0], out var targetPlayer))
|
2020-12-23 16:24:05 +01:00
|
|
|
|
{
|
2025-06-17 16:49:58 -04:00
|
|
|
|
shell.WriteLine(Loc.GetString($"shell-target-player-does-not-exist"));
|
2020-12-23 16:24:05 +01:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-17 16:49:58 -04:00
|
|
|
|
_adminManager.PromoteHost(targetPlayer);
|
2020-12-23 16:24:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|