2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Chat.Managers;
|
2021-12-13 16:45:49 +11:00
|
|
|
using Content.Shared.Administration;
|
2021-02-01 16:49:43 -08:00
|
|
|
using Robust.Shared.Console;
|
2020-12-03 03:40:47 +01:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Chat.Commands
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
|
|
|
|
[AnyCommand]
|
2025-06-18 20:03:28 -04:00
|
|
|
internal sealed class OOCCommand : LocalizedCommands
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
2025-06-18 20:03:28 -04:00
|
|
|
[Dependency] private readonly IChatManager _chatManager = default!;
|
2020-12-03 03:40:47 +01:00
|
|
|
|
2025-06-18 20:03:28 -04:00
|
|
|
public override string Command => "ooc";
|
|
|
|
|
|
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
2023-10-28 09:59:53 +11:00
|
|
|
if (shell.Player is not { } player)
|
2021-03-16 15:50:20 +01:00
|
|
|
{
|
2025-06-18 20:03:28 -04:00
|
|
|
shell.WriteError(Loc.GetString($"shell-cannot-run-command-from-server"));
|
2021-03-16 15:50:20 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-03 03:40:47 +01:00
|
|
|
if (args.Length < 1)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var message = string.Join(" ", args).Trim();
|
|
|
|
|
if (string.IsNullOrEmpty(message))
|
|
|
|
|
return;
|
|
|
|
|
|
2025-06-18 20:03:28 -04:00
|
|
|
_chatManager.TrySendOOCMessage(player, message, OOCChatType.OOC);
|
2020-12-03 03:40:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|