Merge remote-tracking branch 'ghsa/handshake-final-update-fix' into general-devel

This commit is contained in:
Lucas Nicodemus 2025-03-10 01:08:28 +09:00
commit 56041f2c1a
No known key found for this signature in database
6 changed files with 111 additions and 24 deletions

View file

@ -1440,7 +1440,7 @@ namespace TShockAPI
if (tsplr.ReceivedInfo)
{
if (!tsplr.SilentKickInProgress && tsplr.State >= 3 && tsplr.FinishedHandshake) //The player has left, do not broadcast any clients exploiting the behaviour of not spawning their player.
if (!tsplr.SilentKickInProgress && tsplr.State >= (int)ConnectionState.RequestingWorldData && tsplr.FinishedHandshake) //The player has left, do not broadcast any clients exploiting the behaviour of not spawning their player.
Utils.Broadcast(GetString("{0} has left.", tsplr.Name), Color.Yellow);
Log.Info(GetString("{0} disconnected.", tsplr.Name));
@ -1461,7 +1461,6 @@ namespace TShockAPI
}
}
tsplr.FinishedHandshake = false;
// Fire the OnPlayerLogout hook too, if the player was logged in and they have a TSPlayer object.
@ -1495,6 +1494,7 @@ namespace TShockAPI
if (!tsplr.FinishedHandshake)
{
tsplr.Kick(GetString("Your client didn't send the right connection information."), true);
args.Handled = true;
return;
}
@ -1678,7 +1678,7 @@ namespace TShockAPI
return;
}
if ((player.State < 10 || player.Dead) && (int)type > 12 && (int)type != 16 && (int)type != 42 && (int)type != 50 &&
if ((player.State < (int)ConnectionState.Complete || player.Dead) && (int)type > 12 && (int)type != 16 && (int)type != 42 && (int)type != 50 &&
(int)type != 38 && (int)type != 21 && (int)type != 22 && type != PacketTypes.SyncLoadout)
{
e.Handled = true;