Hi, I Have A Plugin That Add Few Items To Player's Inventory But, I Want To Check If The Player Had The Empty Slots Needed Example : I Want To Give Player 1 Wood and 1 Sword, Then It Will Need 2 Empty Slots How To Check It? Sorry For My Bad English
Use PlayerInventory::canAddItem(Item); PHP: $item = Item::get(Item::IRON_SWORD, 0, 1);/** @var Player $player */if($player->getInventory()->canAddItem($item)){ //There is space for $item in $player's inventory.}