mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 01:39:52 +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{
|
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
|
* @param Item[] $oldContents
|
||||||
*/
|
*/
|
||||||
public function onContentChange(Inventory $inventory, array $oldContents) : void{
|
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