Hello, i have a problem with my plugin this is for adding a enchant to an item in hand but it do nothing that's my code PHP: $player->getInventory()->getItemInHand()->addEnchantment(new EnchantmentInstance(Enchantment::getEnchantment(5), 3));
$player = $event->getPlayer(); $inv = $player->getInventory(); $item = $inv->getItemInHand(); $item->addEnchantment(new EnchantmentInstance(Enchantment::getEnchantment(5), 3)); $inv->setItemInHand($item); I don't know how to put the code in the format you have, but here is an example for how to fix your problem. When you add an enchantment to an $item, you basically make a clone of it in code, and in no way affect the player's inventory. This is why you need to setItemInHand to that specific item after adding an enchantment to it. I hope I helped you.