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;
}
java类org.bukkit.inventory.meta.BookMeta.Generation的实例源码
SpellTome.java 文件源码
项目:MystiCraft
阅读 23
收藏 0
点赞 0
评论 0
FBull.java 文件源码
项目:FactionsXL
阅读 21
收藏 0
点赞 0
评论 0
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;
}
FBull.java 文件源码
项目:FactionsXL
阅读 30
收藏 0
点赞 0
评论 0
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;
}