Ensure TSPlayer.PlayerData is non-null whilst syncing loadouts
During connection, we receive a `SyncLoadout` packet before the `ContinueConnecting2` packet, meaning we have not yet created a `PlayerData` for this player.
This commit is contained in:
parent
d00e78ed12
commit
b5b72e9f6c
1 changed files with 5 additions and 0 deletions
|
|
@ -4445,6 +4445,11 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
|
||||
// Don't modify the player data if it isn't there.
|
||||
// This is the case whilst the player is connecting, as we receive the SyncLoadout packet before the ContinueConnecting2 packet.
|
||||
if (args.Player.PlayerData == null)
|
||||
return false;
|
||||
|
||||
// The client does not sync slot changes when changing loadouts, it only tells the server the loadout index changed,
|
||||
// and the server will replicate the changes the client did. This means that PlayerData.StoreSlot is never called, so we need to
|
||||
// swap around the PlayerData items ourself.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue