mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
ContainerTrait: use a static-analysis-friendly way to read NBT, fixes 4 phpstan level 8 errors
This commit is contained in:
@ -44,9 +44,7 @@ trait ContainerTrait{
|
||||
abstract public function getRealInventory();
|
||||
|
||||
protected function loadItems(CompoundTag $tag) : void{
|
||||
if($tag->hasTag(Container::TAG_ITEMS, ListTag::class)){
|
||||
$inventoryTag = $tag->getListTag(Container::TAG_ITEMS);
|
||||
|
||||
if(($inventoryTag = $tag->getTag(Container::TAG_ITEMS)) instanceof ListTag){
|
||||
$inventory = $this->getRealInventory();
|
||||
$listeners = $inventory->getListeners()->toArray();
|
||||
$inventory->getListeners()->remove(...$listeners); //prevent any events being fired by initialization
|
||||
|
Reference in New Issue
Block a user