DeliverRequirement.java 文件源码

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

项目:QuestManager 作者:
@Override
public void fromConfig(ConfigurationSection config) throws InvalidConfigurationException {
    //we need to load information about what we need to possess and how much
    //our config is 
    //  type: "delr"
    //  itemYype: (Material. ENUM CONSTANT NAME)
    //  count: [int]
    //  name: [string]

    if (!config.contains("type") || !config.getString("type").equals("delr")) {
        throw new InvalidConfigurationException("\n  ---Invalid type! Expected 'delr' but got " + config.getString("type", "null"));
    }

    this.itemType = Material.valueOf(
            config.getString("itemType", "AIR"));

    this.itemCount = config.getInt("count", 1);

    this.itemName = config.getString("name", "");
    if (itemName.trim().isEmpty()) {
        itemName = null;
    }

    this.desc = config.getString("description", "Collect " + itemCount + " " +
            itemName == null ? itemType.toString() : itemName);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号