workaround for callback-validator not understanding arrow functions

This commit is contained in:
Dylan T 2024-03-25 14:58:21 +00:00 committed by GitHub
parent f799cfaba6
commit 09904dc519
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -158,7 +158,9 @@ abstract class Living extends Entity{
}
};
$this->armorInventory->getListeners()->add(new CallbackInventoryListener(
fn(Inventory $inventory, int $slot, Item $oldItem) => $playArmorSound($inventory->getItem($slot), $oldItem),
function(Inventory $inventory, int $slot, Item $oldItem) : void{
$playArmorSound($inventory->getItem($slot), $oldItem);
},
function(Inventory $inventory, array $oldContents) use ($playArmorSound) : void{
foreach($oldContents as $slot => $oldItem){
$playArmorSound($inventory->getItem($slot), $oldItem);