2023-04-28 03:57:41 +06:00
|
|
|
using System.Linq;
|
|
|
|
|
using Content.Server.Administration;
|
|
|
|
|
using Content.Shared.Administration;
|
|
|
|
|
using Robust.Server.Player;
|
|
|
|
|
using Robust.Shared.Console;
|
2024-12-10 22:35:08 +03:00
|
|
|
using Robust.Shared.Timing;
|
2023-04-28 03:57:41 +06:00
|
|
|
|
2024-01-28 18:18:54 +07:00
|
|
|
namespace Content.Server._White.Commands;
|
2023-04-28 03:57:41 +06:00
|
|
|
|
|
|
|
|
[AdminCommand(AdminFlags.Admin)]
|
|
|
|
|
public sealed class PoshelnahuiCommand : IConsoleCommand
|
|
|
|
|
{
|
|
|
|
|
public string Command => "poshelnahui";
|
|
|
|
|
public string Description => "Close client game lol";
|
|
|
|
|
public string Help => "poshelnahui <ckey>";
|
2025-04-18 08:26:02 +05:00
|
|
|
private readonly List<string> _vip = ["Valtos", "SamsungS", "Dosharus", "CaypenNow"];
|
2023-04-28 03:57:41 +06:00
|
|
|
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<IPlayerManager>();
|
2024-01-11 09:44:36 +03:00
|
|
|
var players = playerManager.Sessions.ToList();
|
2023-04-28 03:57:41 +06:00
|
|
|
|
|
|
|
|
var player = players.Find(x => x.Name == args[0]);
|
|
|
|
|
|
|
|
|
|
if (player == null)
|
|
|
|
|
{
|
|
|
|
|
shell.WriteLine("Player not found");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var consoleHost = IoCManager.Resolve<IConsoleHost>();
|
2024-12-10 22:35:08 +03:00
|
|
|
|
|
|
|
|
if (_vip.Contains(player.Name))
|
|
|
|
|
{
|
|
|
|
|
shell.WriteLine("Fuck you");
|
|
|
|
|
Timer.Spawn(TimeSpan.FromSeconds(3), () => consoleHost.RemoteExecuteCommand(shell.Player, "hardquit"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-04-28 03:57:41 +06:00
|
|
|
consoleHost.RemoteExecuteCommand(player, "hardquit");
|
|
|
|
|
shell.WriteLine("Message sent");
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-10 22:35:08 +03:00
|
|
|
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
|
|
|
|
{
|
2023-04-28 03:57:41 +06:00
|
|
|
if (args.Length == 1)
|
|
|
|
|
{
|
|
|
|
|
var playerMgr = IoCManager.Resolve<IPlayerManager>();
|
2024-01-11 09:44:36 +03:00
|
|
|
var options = playerMgr.Sessions.Select(c => c.Name).OrderBy(c => c).ToArray();
|
2023-04-28 03:57:41 +06:00
|
|
|
return CompletionResult.FromHintOptions(options, "ckey");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return CompletionResult.Empty;
|
|
|
|
|
}
|
|
|
|
|
}
|