Why Wont This Work?

Discussion in 'Plugin Development' started by jackster090, Jul 5, 2015.

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

    jackster090

    Hey everyone!

    I am trying to make a plugin that adds a diamond pickaxe to the players inventory on command but it's not working. It adds the pickaxe to the inventory, but it is not adding the enchantments, names and lore. Please Help?

    My code is here: http://hastebin.com/ipatozagoc.avrasm

    Thanks for reading and I hope you can help me,
    Jack Martin.
    (Jackster090)
     
  2. Offline

    WesJD

    Use ItemStack#getItemMeta on the pick variable instead of using getItem(0).
     
  3. @jackster090
    As for the enchantments; you are using too high values for them. Use addUnsafeEnchantment() instead.
     
  4. Offline

    schwabfl

    Set the itemstack's meta before adding the itemstack to the inventory.
    Also use itemMeta.addEnchant(Enchantment.SOME_ENCHANTMENT, 10, true)

    And why silk touch level 10?
     
  5. Offline

    SuperSniper

  6. Offline

    jackster090

    Thanks for your help:)

    And Why not? :p
     
  7. Offline

    schwabfl

    Bescause silk touch always has the same effect, regardless of the enchantment level
     
  8. Offline

    jackster090

    I know, I just did it so it fitted in with all the other Level 10 enchants

    Funny thing is with that code is, you forgot the else statement XD
     
Thread Status:
Not open for further replies.

Share This Page