NetworkSession: Fixed InventoryManager nullability disaster

fixes #4277
fixes #4275
fixes #3139
This commit is contained in:
Dylan K. Taylor
2021-06-26 17:44:42 +01:00
parent e43bca95bf
commit 0910054c41
8 changed files with 74 additions and 48 deletions

View File

@@ -672,7 +672,7 @@ class NetworkSession{
}
private function beginSpawnSequence() : void{
$this->setHandler(new PreSpawnPacketHandler($this->server, $this->player, $this));
$this->setHandler(new PreSpawnPacketHandler($this->server, $this->player, $this, $this->invManager));
$this->player->setImmobile(); //TODO: HACK: fix client-side falling pre-spawn
$this->logger->debug("Waiting for chunk radius request");
@@ -691,7 +691,7 @@ class NetworkSession{
$this->player->setImmobile(false); //TODO: HACK: we set this during the spawn sequence to prevent the client sending junk movements
$this->player->doFirstSpawn();
$this->forceAsyncCompression = false;
$this->setHandler(new InGamePacketHandler($this->player, $this));
$this->setHandler(new InGamePacketHandler($this->player, $this, $this->invManager));
}
public function onServerDeath() : void{
@@ -705,7 +705,7 @@ class NetworkSession{
$this->syncAdventureSettings($this->player);
$this->invManager->syncAll();
$this->setHandler(new InGamePacketHandler($this->player, $this));
$this->setHandler(new InGamePacketHandler($this->player, $this, $this->invManager));
}
public function syncMovement(Vector3 $pos, ?float $yaw = null, ?float $pitch = null, int $mode = MovePlayerPacket::MODE_NORMAL) : void{
@@ -937,7 +937,7 @@ class NetworkSession{
$this->sendDataPacket(SetDifficultyPacket::create($worldDifficulty));
}
public function getInvManager() : InventoryManager{
public function getInvManager() : ?InventoryManager{
return $this->invManager;
}