Quick bug fix - forgot about respawns + only set handshake once

The connection state should NEVER be set to under 3 if the player is fully connected.
This commit is contained in:
ohayo 2025-02-02 12:40:04 +10:00
parent 4c01740177
commit 4f2fff050d
2 changed files with 4 additions and 2 deletions

View file

@ -2726,7 +2726,8 @@ namespace TShockAPI
short numberOfDeathsPVP = args.Data.ReadInt16();
PlayerSpawnContext context = (PlayerSpawnContext)args.Data.ReadByte();
args.Player.FinishedHandshake = args.Player.State == 3; //If the player has requested world data before sending spawn player, this should be set to 3, otherwise it'll be set to 1.
if (args.Player.State >= 3 && !args.Player.FinishedHandshake)
args.Player.FinishedHandshake = true; //If the player has requested world data before sending spawn player, this should be equal to or greater than 3, otherwise it'll usually be 1. Also only set this once to remove redundant updates.
if (OnPlayerSpawn(args.Player, args.Data, player, spawnx, spawny, respawnTimer, numberOfDeathsPVE, numberOfDeathsPVP, context))
return true;

View file

@ -1461,7 +1461,8 @@ namespace TShockAPI
}
}
TShock.Log.ConsoleInfo($"Setting handshake to false for {tsplr.Name}");
tsplr.FinishedHandshake = false;
// Fire the OnPlayerLogout hook too, if the player was logged in and they have a TSPlayer object.