Inventory: Fixed crash when breaking right half of a double chest while open

This commit is contained in:
Dylan K. Taylor
2018-01-27 10:56:03 +00:00
parent de0741f727
commit 3e35bc38e2
2 changed files with 13 additions and 11 deletions

View File

@ -101,14 +101,14 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
public function onOpen(Player $who) : void{
parent::onOpen($who);
if(count($this->getViewers()) === 1){
$this->broadcastBlockEventPacket($this->right->getHolder(), true);
if(count($this->getViewers()) === 1 and $this->right->getHolder()->isValid()){
$this->right->broadcastBlockEventPacket(true);
}
}
public function onClose(Player $who) : void{
if(count($this->getViewers()) === 1){
$this->broadcastBlockEventPacket($this->right->getHolder(), false);
if(count($this->getViewers()) === 1 and $this->right->getHolder()->isValid()){
$this->right->broadcastBlockEventPacket(false);
}
parent::onClose($who);
}