Is there a way to check if inventory is full? Because i wanna do addItem(), so what if the inventory of the player is full and additem() didn't work?
I think theres a function called Inventory::canAddItem(), if that doesnt exist theres a code PHP: public function isInventoryFull(Player $player){ $full = true; for($i = 0;$i < $player->getInventory()->getSize();$i++){ if($player->getInventory()->getItem($i)->getId() === 0){ $full = false; } } return $full;}
PHP: $item = $player->getInventory()->getItemInHand();$item->setCount($item->getCount() - 1);$player->getInventory()->setItemInHand($item); next time open a new thread