Add enchantment to item stack

Discussion in 'Spigot Help' started by yeison, Sep 23, 2016.

  1. Hello.

    How can I get one or more enchantments in this?

    Code (Text):

                new ItemStack(Material.DIAMOND_BOOTS),
                new ItemStack(Material.DIAMOND_LEGGINGS),
                new ItemStack(Material.DIAMOND_CHESTPLATE),
                new ItemStack(Material.DIAMOND_HELMET),
    • Informative Informative x 1
  2. Code (Text):
    ItemStack stack = new ItemStack(Material.ANYMATERIAL);
    ItemMeta meta = stack.getItemMeta();
    meta.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
    That should work.
    • Agree Agree x 1
    • Winner Winner x 1
    • Informative Informative x 1
  3. So how to add multiple?