From 7d9c960b0fb9d3358dcf1caa3e5b3c7d3d46b806 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Fri, 27 Feb 2015 00:38:47 -0700 Subject: [PATCH] Add config option for saving the world when last player exists --- TShockAPI/ConfigFile.cs | 3 +++ TShockAPI/TShock.cs | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index be24b8b8..cf0cf21a 100755 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -394,6 +394,9 @@ namespace TShockAPI [Description("The maximum allowable MP, before equipment buffs.")] public int MaxMP = 200; + [Description("Determines if the server should save the world if the last player exits.")] + public bool SaveWorldOnLastPlayerExit = true; + /// /// Reads a configuration file from a given path /// diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 436acbea..21cadf21 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1026,7 +1026,8 @@ namespace TShockAPI // The last player will leave after this hook is executed. if (Utils.ActivePlayers() == 1) { - SaveManager.Instance.SaveWorld(); + if (Config.SaveWorldOnLastPlayerExit) + SaveManager.Instance.SaveWorld(); SetConsoleTitle(true); } }