mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 20:14:31 +00:00
NetworkSession: account for possibility of syncGameMode() being called before the player is ready to receive it
close #4323
This commit is contained in:
@@ -754,8 +754,10 @@ class NetworkSession{
|
||||
|
||||
public function syncGameMode(GameMode $mode, bool $isRollback = false) : void{
|
||||
$this->sendDataPacket(SetPlayerGameTypePacket::create(TypeConverter::getInstance()->coreGameModeToProtocol($mode)));
|
||||
$this->syncAdventureSettings($this->player);
|
||||
if(!$isRollback){
|
||||
if($this->player !== null){
|
||||
$this->syncAdventureSettings($this->player);
|
||||
}
|
||||
if(!$isRollback && $this->invManager !== null){
|
||||
$this->invManager->syncCreative();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user