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.
This commit is contained in:
MarioE 2017-06-19 01:15:45 -04:00
parent 15b53ab726
commit 331eeb8cec

View file

@ -1405,9 +1405,14 @@ namespace TShockAPI
} }
var tsplr = Players[args.Who]; var tsplr = Players[args.Who];
if (tsplr == null)
{
return;
}
Players[args.Who] = null; Players[args.Who] = null;
if (tsplr != null && tsplr.ReceivedInfo) if (tsplr.ReceivedInfo)
{ {
if (!tsplr.SilentKickInProgress && tsplr.State >= 3) if (!tsplr.SilentKickInProgress && tsplr.State >= 3)
Utils.Broadcast(tsplr.Name + " has left.", Color.Yellow); 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. // 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); Hooks.PlayerHooks.OnPlayerLogout(tsplr);
} }