Enchanting -- Value Too High

Discussion in 'Spigot Plugin Development' started by YourCoal, May 29, 2017.

  1. I am having a problem with enchanting items, where it will not let me enchant efficiency 6 due to the game maxing at 5.

    Code (Text):
                Map<Enchantment, Integer> newEnch = new HashMap<Enchantment, Integer>();
                newEnch.put(Enchantment.DIG_SPEED, 6); //error here, can't have number too high or too low
                ItemStack newItem = new ItemStack(Material.DIAMOND_PICKAXE, 1);
    I do not know of a way to do this, any ideas?
  2. Use ItemStack#addUnsafeEnchantments instead.

    Sent from my iPhone using Tapatalk
    • Agree Agree x 1
  3. The problem with that I am using the method to get a collection of enchants BEFORE creating the item, because in the way I am coding it is how it goes or else I get errors. I am trying to see if there is another way around that, or else I will have to start over with the work I have.
  4. Simple use
    Code (Text):