From 91c41aa68bf61dd647a275e8851015aa2e6df82e Mon Sep 17 00:00:00 2001 From: White Date: Wed, 27 Apr 2016 15:12:43 +0930 Subject: [PATCH] Adds a `--no-restart` command-line argument for Multiplay --- TShockAPI/Commands.cs | 6 ++++++ TShockAPI/TShock.cs | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 3f483269..9d454d21 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -1743,6 +1743,12 @@ namespace TShockAPI private static void Restart(CommandArgs args) { + if (TShock.NoRestart) + { + args.Player.SendErrorMessage("This command has been disabled."); + return; + } + if (ServerApi.RunningMono) { TShock.Log.ConsoleInfo("Sorry, this command has not yet been implemented in Mono."); diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 439403ee..870659bc 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -67,6 +67,11 @@ namespace TShockAPI /// LogClear - Determines whether or not the log file should be cleared on initialization. private static bool LogClear; + /// + /// Set by the command line, disables the '/restart' command. + /// + internal static bool NoRestart; + /// Players - Contains all TSPlayer objects for accessing TSPlayers currently on the server public static TSPlayer[] Players = new TSPlayer[Main.maxPlayers]; /// Bans - Static reference to the ban manager for accessing bans & related functions. @@ -690,6 +695,11 @@ namespace TShockAPI TShock.StatTracker.OptOut = true; break; } + case "--no-restart": + { + TShock.NoRestart = true; + break; + } } } }