$player->getInventory()->addItem(Item::get(ITEM::IRON_SWORD)); It add item in inventory, how to add item in slots ??
It can crash clients game, so it is a very dangerous function... Kidding use this \pocketmine\inventory\PlayerInventory::setItem ($index, Item $item, $source=null)
private function giveKit(Player $player){ // Clear inventory $player->getInventory()->clearAll(); // Give sword and armor $player->getInventory()->addItem(Item::get(ITEM::IRON_SWORD)); $player->getInventory()->addItem(Item::get(ITEM::BOW)); $player->getInventory()->addItem(Item::get(ITEM::ARROW, 0, 64)); $player->getInventory()->setItemInHand(Item::get(ITEM::IRON_SWORD), $player); I need to put item in slots
If you mean setting items in first 9 slots in the inventory to the hotbar... PHP: for($i = 0; $i <= 8; $i++){ $inventory->setHotbarSlotIndex($i, $i);}
http://docs.pocketmine.net/dc/d77/c...entory.html#aa2c8b45b25cac829ee9316dd5b7b5931 Player. It means that the inventory change originated from that player, so don't send that to the player because he already knows.