EquipItem.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:ZentrelaRPG 作者:
@Override
public ItemStack generate() {
    ItemStack item = new ItemStack(material);
    ItemMeta im = item.getItemMeta();
    // prepend reset to clear the default name coloring
    im.setDisplayName(ChatColor.RESET + name);
    // Get lore from string
    List<String> lore = stats.lore();
    if (soulbound) {
        lore.add(ChatColor.RED + ChatColor.ITALIC.toString() + "Soulbound");
    }
    // Get description, if it exists
    if (description != null && description.length() > 0) {
        if (lore.size() > 0 && lore.get(lore.size() - 1).length() > 0)
            lore.add("");
        lore.addAll(RFormatter.stringToLore(description, ChatColor.GRAY));
    }

    im.setLore(lore);
    im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
    im.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
    im.addItemFlags(ItemFlag.HIDE_DESTROYS);
    im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
    im.addItemFlags(ItemFlag.HIDE_PLACED_ON);
    im.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);

    // Add color for leather armors
    if (leatherColor != null) {
        ((LeatherArmorMeta) im).setColor(leatherColor);
    }

    item.setItemMeta(im);
    return item;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号