public static ItemStack getSpellTome(String label, Player crafter) { ItemStack i = new ItemStack(MATERIAL); Spell spell = MystiCraft.getSpellManager().getSpell(label); BookMeta meta = (BookMeta)i.getItemMeta(); meta.setDisplayName(DISPLAY_NAME + StringUtils.capitalize(label)); if (crafter != null) meta.setAuthor(crafter.getName()); else meta.setAuthor("unknown"); meta.setGeneration(Generation.TATTERED); meta.setLore(Arrays.asList(new String[]{ChatColor.GRAY + spell.getDescription(), ChatColor.GRAY + "Mana Cost: " + spell.getManaCost()})); // TODO Add description meta.addPage("-------------------=-=-=-=-=-=-=-=-=-=-=-=-=-=-="); i.setItemMeta(meta); return i; }
public static ItemStack create(ItemStack item, String name) { if (!(item.getItemMeta() instanceof BookMeta)) { return null; } BookMeta meta = (BookMeta) item.getItemMeta(); meta.setAuthor(name); meta.setTitle(meta.getTitle()); meta.setLore(Arrays.asList(FMessage.BULL_ID.getMessage(), FMessage.BULL_RIGHT_KLICK.getMessage())); meta.setGeneration(Generation.ORIGINAL); ItemStack bull = new ItemStack(Material.WRITTEN_BOOK); bull.setItemMeta(meta); return bull; }
public static boolean isBull(ItemStack item) { return isValid(item, 0) && item.getItemMeta().getLore().get(0).equals(FMessage.BULL_ID.getMessage()) && ((BookMeta) item.getItemMeta()).getGeneration() == Generation.ORIGINAL; }