[Unsolved] Add Enchantment's to a Stick

Discussion in 'Plugin Development' started by ASHninja1997, Aug 5, 2013.

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

    ASHninja1997

    So I am trying to add an enchantment to a Blaze_Rod and save it to a HashMap but when ever I try to do that it sends me a error in the console saying "Can't add Specified enchantment to this item." Why is this doing this...isn't this supposed to work.
    Code:
          ItemStack BLAZE_ROD = new ItemStack(Material.BLAZE_ROD);
          BLAZE_ROD.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 5);
          ItemStack b = new ItemStack(BLAZE_ROD);
    fweapon.put(p.getName(), b);
     
  2. Offline

    Pizza371

    ASHninja1997 why are you defining an itemstack then setting another itemstack to that itemstack :confused:?
    You only need:
    Code:
    ItemStack b = new ItemStack(Material.BLAZE_ROD);
    b.addUnsafeEnchantments(Enchantment.enchantment, lvl);
    fweapon.put(p.getName(), b);
    
     
  3. Offline

    ASHninja1997

  4. Offline

    Axe2760

    Exactly what code are you running that gives you the error?
     
  5. Offline

    Pizza371

    ASHninja1997 Hmm.. strange Maybe try and add it to a sword then see if that works? lil old debugg
     
  6. Offline

    ASHninja1997

    The error from the console is saying "Can't add specified enchantment to this item"
    I will try this then report back with the results I get
     
Thread Status:
Not open for further replies.

Share This Page