Hi guys, i've wanted to ask for this error on give enchanted items to players... PHP: $inventory->addItem(Item::get(293,0,1)->addEnchantment(Enchantment::getEnchantment(12))); it gives this error:
Sure! PHP: $item = Item::get(311,0,1); $item->addEnchantment(Enchantment::getEnchantment(0)->setLevel(2)); $item->setCustomName("§l§9Magical Chestplate§r"); $inventory->addItem($item);
The error isn't for line 251 of the plugin. You would notice if you read it more carefully. The error happens because your item isn't a valid Item object. This should be a solution to your problem.
I know... I thought that he's searching for my working code... And i just shared it... Btw... I just put Solved on thread so :/