2020-12-03 03:40:47 +01:00
|
|
|
|
using Content.Server.Administration;
|
|
|
|
|
|
using Content.Shared.Administration;
|
2021-06-20 10:09:24 +02:00
|
|
|
|
using Content.Shared.CCVar;
|
|
|
|
|
|
using Robust.Shared.Configuration;
|
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.GameTicking.Commands
|
2020-12-03 03:40:47 +01:00
|
|
|
|
{
|
2021-11-29 14:40:10 -06:00
|
|
|
|
[AdminCommand(AdminFlags.Round)]
|
2025-06-18 20:03:28 -04:00
|
|
|
|
public sealed class ToggleDisallowLateJoinCommand : LocalizedCommands
|
2020-12-03 03:40:47 +01:00
|
|
|
|
{
|
2025-06-18 20:03:28 -04:00
|
|
|
|
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
2020-12-03 03:40:47 +01:00
|
|
|
|
|
2025-06-18 20:03:28 -04:00
|
|
|
|
public override string Command => "toggledisallowlatejoin";
|
|
|
|
|
|
|
|
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
2020-12-03 03:40:47 +01:00
|
|
|
|
{
|
|
|
|
|
|
if (args.Length != 1)
|
|
|
|
|
|
{
|
2025-06-18 20:03:28 -04:00
|
|
|
|
shell.WriteLine(Loc.GetString($"shell-need-exactly-one-argument"));
|
2020-12-03 03:40:47 +01:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (bool.TryParse(args[0], out var result))
|
|
|
|
|
|
{
|
2025-06-18 20:03:28 -04:00
|
|
|
|
_configManager.SetCVar(CCVars.GameDisallowLateJoins, bool.Parse(args[0]));
|
|
|
|
|
|
shell.WriteLine(Loc.GetString(result ? "cmd-toggledisallowlatejoin-disabled" : "cmd-toggledisallowlatejoin-enabled"));
|
2020-12-03 03:40:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
else
|
2025-06-18 20:03:28 -04:00
|
|
|
|
shell.WriteLine(Loc.GetString($"shell-invalid-bool"));
|
2020-12-03 03:40:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|