update ItemMeta

Discussion in 'Plugin Development' started by R1DD!, Dec 28, 2021.

  1. Offline


    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);
  2. Offline


    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



Share This Page