And how I can check it? :/ SOLVED, I was checking PocketMine classes and I saw firstEmpty x) I suppose that PHP: $inv->firstEmpty() == 0; is enought. Thanks!
No. What if there's a stack in the second slot? You must iterate over every slot and check if the inventory has a slot that isn't air.
Here is your solution: PHP: public function isInventoryEmpty(Player $player) { for($i = 0; $i < $player->getInventory()->getSize(); $i++) { if($player->getInventory()->getItem($i)->getId() == 0) { return true; } }}
Nope, that will return true when it finds the first empty slot PHP: public function isInventoryEmpty(Player $player) { for($i = 0; $i < $player->getInventory()->getSize(); $i++) { if($player->getInventory()->getItem($i)->getId() !== 0) { return false; } } return true;}