Solved 2 Enchantments 1 item help

Discussion in 'Plugin Development' started by Arrxzon, Dec 14, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Arrxzon

    ItemStack is = new ItemStack(Material.STONE_SWORD, 1);
    is.addEnchantment(Enchantment.DAMAGE_ALL,1);

    how do i add a second enchantment or a 3rd and 4th
    because simply
    ItemStack is = new ItemStack(Material.STONE_SWORD, 1);
    is.addEnchantment(Enchantment.DAMAGE_ALL,1);
    is.addEnchantment(Enchantment.FIRE_ASPECT,1);

    just throws a bunch of errors
    thanks guys
     
  2. Offline

    sgavster

    I need to error to help.
     
  3. Offline

    Arrxzon

    http://pastebin.com/RGHXfCbX

    Caused by: java.lang.IllegalArgumentException: Enchantment level is either too low or too high (given 0, bounds are 1 to 4)
    Don't quite understand that because i have 1 added as the enchantment levels
     
  4. Offline

    AoH_Ruthless

    Arrxzon
    Paste your whole RankKits class.
     
  5. Offline

    Arrxzon

  6. Offline

    Gater12

    Arrxzon That title though....
    Try doing is.addUnsafeEnchantment();
     
    AzubuSan likes this.
  7. Offline

    Arrxzon

    bump ?
     
  8. Offline

    cruz2000

    You only do .addUnsafeEnchantment(); when the enchantment level is over the bounds what i mean is. If its sharp 6 then you do .addUnsafeEnchantment(Enchant.DAMAGE_ALL, 6); . If its regular just do .addEnchant(Enchant.DAMAGE_ALL, 5).
     
  9. Offline

    MarinD99

    did you do the p.getInventory().addItem(is); ?
     
    Arrxzon likes this.
Thread Status:
Not open for further replies.

Share This Page