Config.java 文件源码

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

项目:CS-CoreLib 作者:
/**
 * Returns the ItemStack at the specified Path
 *
 * @param  path The path in the Config File
 * @return      The ItemStack at that Path
 */ 
public ItemStack getItem(String path) {
    ItemStack item = config.getItemStack(path);
    if (item == null) return null;
    try {
        if (item.hasItemMeta() && item.getItemMeta() instanceof SkullMeta) {
            if (config.contains(path + "_extra.custom-skull")) item = CustomSkull.getItem((ItemStack) item, config.getString(path + "_extra.custom-skull"));
            if (config.contains(path + "_extra.custom-skullOwner") && !((ItemStack) item).getItemMeta().hasDisplayName()) {
                ItemMeta im = ((ItemStack) item).getItemMeta();
                im.setDisplayName("�r" + config.getString(path + "_extra.custom-skullOwner") + "'s Head");
                ((ItemStack) item).setItemMeta(im);
            }
        }
        else {
            config.set(path + "_extra.custom-skull", null);
            config.set(path + "_extra.custom-skullOwner", null);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return item;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号