I add enchantment to the item when clicked, but it appears after the relog, how can I update the properties without the relog? That is, when you click on the block, enchantment is added to the sword. But after clicks, the item is enchanted only after the relog A piece of code, maybe I'm doing something wrong int sharpLvl = ironSwordMeta.getEnchantLevel(Enchantment.DAMAGE_ALL); ironSwordMeta.addEnchant(Enchantment.DAMAGE_ALL, sharpLvl+1, true); ironSword.setItemMeta(ironSwordMeta); p.updateInventory();
I am going to personally try and solve the problem another way tomorrow but for now, you may have to use the long method of creating an item stack of the iron sword and enchanting it, then giving it to the player https://bukkit.org/threads/add-enchantment-to-item-stack.163913/ https://helpch.at/docs/1.8/index.html?org/bukkit/enchantments/Enchantment.html