Here is my code: PHP: $item = Item::get(Item::BOW, 0, 1); $item->addEnchantment(Enchantment::getEnchantment(22)->setLevel(1)); $item->setCustomName("§bDetektivuv luk"); $p->getInventory()->addItem($item); And here error: Code: [11:27:37] [Server thread/CRITICAL]: Could not execute task MurderMystery\Arena\ArenaScheduler: Call to a member function setLevel() on null [11:27:37] [Server thread/CRITICAL]: Error: "Call to a member function setLevel() on null" (EXCEPTION) in "murder/src/MurderMystery/Arena/Arena" at line 296 Without addEnchantment works without error EDIT: 22 is infinity
Because enchantment with Id 22 is not yet registered in PMMP. https://github.com/pmmp/PocketMine-...ine/item/enchantment/Enchantment.php#L89-#L95