How to get enchantment Ids for /iteminfo?

Discussion in 'Spigot Plugin Development' started by Luctastic, Jun 14, 2018.

  1. So this already works fine, but I tried already everything to get item IDs for enchanted items and I don't get it

    Thanks for your help :)

    Code (Text):

    int itemid = p.getInventory().getItemInMainHand().getTypeId();
    short itemDur = p.getInventory().getItemInMainHand().getDurability();
    p.sendMessage(servername + "Item: " + p.getInventory().getItemInMainHand().getType().toString());
    if(itemDur == 0){
    p.sendMessage(servername + "ID: " + itemid);
    } else{
    p.sendMessage(servername + "ID: " + itemid + ":" + itemDur);
    }
     
  2. Praya

    Benefactor

    Code (Java):
    for (Enchantment enchantment : item.getEnchantments().keySet()) {
      final int id = enchantment.getId();
    }
     
    • Like Like x 1
  3. [​IMG].getTypeId();
     
    • Funny Funny x 1

Share This Page