mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +00:00
CallbackInventoryListener: fix crash when any of the callbacks isn't provided
This commit is contained in:
parent
6e6fffa461
commit
f34753c496
@ -72,13 +72,17 @@ class CallbackInventoryListener implements InventoryListener{
|
||||
}
|
||||
|
||||
public function onSlotChange(Inventory $inventory, int $slot, Item $oldItem) : void{
|
||||
($this->onSlotChangeCallback)($inventory, $slot, $oldItem);
|
||||
if($this->onSlotChangeCallback !== null){
|
||||
($this->onSlotChangeCallback)($inventory, $slot, $oldItem);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Item[] $oldContents
|
||||
*/
|
||||
public function onContentChange(Inventory $inventory, array $oldContents) : void{
|
||||
($this->onContentChangeCallback)($inventory, $oldContents);
|
||||
if($this->onContentChangeCallback !== null){
|
||||
($this->onContentChangeCallback)($inventory, $oldContents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user