From 331eeb8cec794a963c05980178327cc6ef866b10 Mon Sep 17 00:00:00 2001 From: MarioE Date: Mon, 19 Jun 2017 01:15:45 -0400 Subject: [PATCH] Fix SaveManager saving when 1 player is on the server and another joins The real fix would be to fix ServerLeave to not fire incorrectly when a player joins, but this will do for now. --- TShockAPI/TShock.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 42cd9ef1..776846fa 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1405,9 +1405,14 @@ namespace TShockAPI } var tsplr = Players[args.Who]; + if (tsplr == null) + { + return; + } + Players[args.Who] = null; - if (tsplr != null && tsplr.ReceivedInfo) + if (tsplr.ReceivedInfo) { if (!tsplr.SilentKickInProgress && tsplr.State >= 3) Utils.Broadcast(tsplr.Name + " has left.", Color.Yellow); @@ -1431,7 +1436,7 @@ namespace TShockAPI } // Fire the OnPlayerLogout hook too, if the player was logged in and they have a TSPlayer object. - if (tsplr != null && tsplr.IsLoggedIn) + if (tsplr.IsLoggedIn) { Hooks.PlayerHooks.OnPlayerLogout(tsplr); }