Hello, I am making a Wand Plugin, and now I am working on spells but this isnt working.. I want to set the lore of the wand to the current spell and then when the player left clicks it checks if the wand has the lore of a spell and then it needs to cast that spell. But this isnt working.. I can really use some help on this
What have you tried? itemMeta.setLore(lore) takes a List (each element is a different line), so if you wanted to have a single lined description, you could simply do itemMeta.setLore(Arrays.asList("Spell Name")); To check it: Code: if (item.hasItemMeta()) // checking it has meta { ItemMeta meta = item.getItemMeta(); if (meta.hasLore()) // checking it has lore { String lore = meta.getLore().get(0); // gets the first item/top line ... } }
This is solved! Make sure you set the ItemMeta for an ItemStack after changing lore! This is where I failed!