Consistently call InventoryCloseEvent

this wasn't being fired when a plugin did the removal.
This commit is contained in:
Dylan K. Taylor 2019-06-14 19:39:35 +01:00
parent f671f2ebfa
commit 8356285b66

View File

@ -2744,7 +2744,6 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
$this->doCloseInventory(); $this->doCloseInventory();
if(isset($this->windowIndex[$windowId])){ if(isset($this->windowIndex[$windowId])){
(new InventoryCloseEvent($this->windowIndex[$windowId], $this))->call();
$this->removeWindow($this->windowIndex[$windowId]); $this->removeWindow($this->windowIndex[$windowId]);
return true; return true;
} }
@ -2844,6 +2843,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
$networkId = $this->windows[$objectId] ?? null; $networkId = $this->windows[$objectId] ?? null;
if($networkId !== null){ if($networkId !== null){
(new InventoryCloseEvent($inventory, $this))->call();
$inventory->onClose($this); $inventory->onClose($this);
unset($this->windows[$objectId], $this->windowIndex[$networkId], $this->permanentWindows[$objectId]); unset($this->windows[$objectId], $this->windowIndex[$networkId], $this->permanentWindows[$objectId]);
} }