From 0c17665f7f6e02f4f79417a84965733424fd54e7 Mon Sep 17 00:00:00 2001 From: rhailrake <49613070+rhailrake@users.noreply.github.com> Date: Fri, 28 Apr 2023 03:57:41 +0600 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=87=D0=B5=D0=BD=D1=8C=20=D0=B2=D0=B0?= =?UTF-8?q?=D0=B6=D0=BD=D0=B0=D1=8F=20=D0=BA=D0=BE=D0=BD=D1=81=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D0=B0=D1=8F=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4?= =?UTF-8?q?=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../White/Commands/PoshelnahuiCommand.cs | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Content.Server/White/Commands/PoshelnahuiCommand.cs diff --git a/Content.Server/White/Commands/PoshelnahuiCommand.cs b/Content.Server/White/Commands/PoshelnahuiCommand.cs new file mode 100644 index 0000000000..598a6dccaa --- /dev/null +++ b/Content.Server/White/Commands/PoshelnahuiCommand.cs @@ -0,0 +1,49 @@ +using System.Linq; +using Content.Server.Administration; +using Content.Shared.Administration; +using Robust.Server.Player; +using Robust.Shared.Console; + +namespace Content.Server.White.Commands; + +[AdminCommand(AdminFlags.Admin)] +public sealed class PoshelnahuiCommand : IConsoleCommand +{ + public string Command => "poshelnahui"; + public string Description => "Close client game lol"; + public string Help => "poshelnahui "; + public void Execute(IConsoleShell shell, string argStr, string[] args) + { + if (args.Length != 1 || string.IsNullOrEmpty(args[0])) + { + shell.WriteLine("Wrong number of arguments"); + return; + } + + var playerManager = IoCManager.Resolve(); + var players = playerManager.ServerSessions.ToList(); + + var player = players.Find(x => x.Name == args[0]); + + if (player == null) + { + shell.WriteLine("Player not found"); + return; + } + + var consoleHost = IoCManager.Resolve(); + consoleHost.RemoteExecuteCommand(player, "hardquit"); + shell.WriteLine("Message sent"); + } + + public CompletionResult GetCompletion(IConsoleShell shell, string[] args) { + if (args.Length == 1) + { + var playerMgr = IoCManager.Resolve(); + var options = playerMgr.ServerSessions.Select(c => c.Name).OrderBy(c => c).ToArray(); + return CompletionResult.FromHintOptions(options, "ckey"); + } + + return CompletionResult.Empty; + } +}