ItemLoader.java 文件源码

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

项目:CraftFX 作者:
/**
 * Adds color to LeatherArmorMeta
 *
 * @param meta   ItemMeta to change
 * @param config Config to read from
 * @throws Exception if there was an error
 */
private void addLeatherArmorMeta(ItemMeta meta, ConfigurationSection config) throws Exception {
    if (!config.contains(LEATHER_ARMOR)) {
        return;
    }

    String color = config.getString(LEATHER_ARMOR);
    String[] rgb = color.split(",");
    if (rgb.length < 3) {
        throw new Exception("Color tag '" + color + "' is invalid");
    }

    ((LeatherArmorMeta) meta).setColor(
            Color.fromRGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]),
                    Integer.parseInt(rgb[2])));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号