Command resolve and LEC conversion batch 3 (#38378)

* I'm just a silly goober

* requested changes

* Update Content.Server/Interaction/TilePryCommand.cs

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
Kyle Tyo
2025-06-17 05:39:42 -04:00
committed by GitHub
parent 1443cda4ff
commit d316fa3483
16 changed files with 148 additions and 148 deletions

View File

@@ -10,7 +10,7 @@ namespace Content.Server.GhostKick;
// Handles logic for "ghost kicking".
// Basically we boot the client off the server without telling them, so the game shits itself.
// Hilariously isn't it?
// Hilarious, isn't it?
public sealed class GhostKickManager
{
@@ -45,32 +45,30 @@ public sealed class GhostKickManager
}
[AdminCommand(AdminFlags.Moderator)]
public sealed class GhostKickCommand : IConsoleCommand
public sealed class GhostKickCommand : LocalizedEntityCommands
{
public string Command => "ghostkick";
public string Description => "Kick a client from the server as if their network just dropped.";
public string Help => "Usage: ghostkick <Player> [Reason]";
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly GhostKickManager _ghostKick = default!;
public void Execute(IConsoleShell shell, string argStr, string[] args)
public override string Command => "ghostkick";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length < 1)
{
shell.WriteError("Need at least one argument");
shell.WriteError(Loc.GetString($"shell-need-exactly-one-argument"));
return;
}
var playerName = args[0];
var reason = args.Length > 1 ? args[1] : "Ghost kicked by console";
var reason = args.Length > 1 ? args[1] : Loc.GetString($"cmd-ghostkick-default-reason");
var players = IoCManager.Resolve<IPlayerManager>();
var ghostKick = IoCManager.Resolve<GhostKickManager>();
if (!players.TryGetSessionByUsername(playerName, out var player))
if (!_playerManager.TryGetSessionByUsername(playerName, out var player))
{
shell.WriteError($"Unable to find player: '{playerName}'.");
shell.WriteError(Loc.GetString($"shell-target-player-does-not-exist"));
return;
}
ghostKick.DoDisconnect(player.Channel, reason);
_ghostKick.DoDisconnect(player.Channel, reason);
}
}