Fixed cyclic reference with chest tiles and DoubleChestInventory

This commit is contained in:
Dylan K. Taylor 2017-09-03 11:24:34 +01:00
parent 1d338bfdf9
commit 0b83c61494
2 changed files with 10 additions and 1 deletions

View File

@ -139,4 +139,9 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
public function getRightSide() : ChestInventory{ public function getRightSide() : ChestInventory{
return $this->right; return $this->right;
} }
public function invalidate(){
$this->left = null;
$this->right = null;
}
} }

View File

@ -67,8 +67,12 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
$player->removeWindow($this->getRealInventory()); $player->removeWindow($this->getRealInventory());
} }
if($this->doubleInventory !== null){
$this->doubleInventory->invalidate();
$this->doubleInventory = null;
}
$this->inventory = null; $this->inventory = null;
$this->doubleInventory = null;
parent::close(); parent::close();
} }