mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
BaseInventory: fixed passing NULL slots to InventoryListener->onContentChange()
as per the documentation, InventoryListener->onContentChange() does not expect to receive NULL in the given array.
This commit is contained in:
parent
070d8efda3
commit
eca0e88471
@ -27,6 +27,7 @@ use Ds\Set;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\ItemFactory;
|
||||
use pocketmine\player\Player;
|
||||
use function array_map;
|
||||
use function array_slice;
|
||||
use function count;
|
||||
use function max;
|
||||
@ -95,7 +96,9 @@ abstract class BaseInventory implements Inventory{
|
||||
$items = array_slice($items, 0, $this->getSize(), true);
|
||||
}
|
||||
|
||||
$oldContents = $this->slots->toArray();
|
||||
$oldContents = array_map(function(?Item $item) : Item{
|
||||
return $item ?? ItemFactory::air();
|
||||
}, $this->slots->toArray());
|
||||
|
||||
$listeners = $this->listeners->toArray();
|
||||
$this->listeners->clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user