From 21cd90fa23e21f1bbf6017d24ae35916e8d44dfd Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 25 Feb 2015 00:09:54 -0700 Subject: [PATCH] Save world on last player exit; fixes #707 --- TShockAPI/TShock.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 97826f51..fdae3db9 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1022,6 +1022,12 @@ namespace TShockAPI RememberedPos.InsertLeavePos(tsplr.Name, tsplr.IP, (int) (tsplr.X/16), (int) (tsplr.Y/16)); } } + + // The last player will leave after this hook is executed. + if (Utils.ActivePlayers() == 1) + { + SaveManager.Instance.SaveWorld(); + } } private void OnChat(ServerChatEventArgs args)