PHP: $p->getInventory()->addItem(new Item($id, $damage, $amount); So, basically you will add the item to the player's inventory So in your case, you will be able to do: PHP: $p->getInventory()->addItem(new Item(276, 0 ,1); Sorry I understood it wrong
Hmmmm.... I don't really understand that code... I want to give item to players by item IDs (example I want to give player a stone sword (ITEM IDs: 272)) How can I do that? But the code u given to me is like a code to do: "if the item is equal to x item" It doesnt match my needs LOL
How many times I have told you to use Item::get() instead of the Item constructor? It may have some issues with special items like buckets, and other plugins may get the item name wrongly!
so PHP: $player->getInventory()->addItem(Item::get($id, $damage, $count));//getInventory() returns PlayerInventory/Inventory object
PHP: $item = Item::get(Item::STONE_SWORD, 0, 1);$item->addEnchantment(Enchantment::get(Enchantment::SHARPNESS));$pl->getInventory()->addItem($item);
Thanks! One last thing... xD Add items to hotbar? I mean the items I given will be shown in hotbar instead in inventory xD
pocketmine\inventory\PlayerInventory::setItem ( $index, Item $item, $source = null) PocketMine has nice API documentation, why you're not using it?