I would like to create a Enchantment Book by my plugin. I tried the following ways: item = new ItemStack( Material.BOOK, amount ); item.addUnsafeEnchantment( ench, level ); item = new ItemStack( material, amount ); ItemMeta meta = item.getItemMeta(); meta.addEnchant( ench, level, false ); item.setItemMeta( meta ); It creates the book, but the player isn't able to enchant his sword with his anvil. May someone can help me ?
@Nosxxx you should be adding stored enchantments. Cast ItemMeta to EnchantmentStorageMeta, and use the Material ENCHANTED_BOOK.
Do this: Code (Text): item = new ItemStack( Material.BOOK, amount ); item.addUnsafeEnchantment( ench, level ); For whatever reason I've also had bad luck when attempting at add enchantments to the item's ItemMeta. Just use addUnsafeEnchantment() on the ItemStack.