ConfigLoader.java 文件源码

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

项目:CommandTimer 作者:
/**
 * Loads the CommandSets.
 *
 * @param config
 * @return
 */
public static Map<String, CommandSet>[] loadSets(Configuration config) {
    Map<String, CommandSet> sets = new HashMap<String, CommandSet>();
    Map<String, CommandSet> commands = new HashMap<String, CommandSet>();
    ConfigurationSection setsSection = config.getConfigurationSection("sets");
    if (setsSection != null) {
        for (String key : setsSection.getKeys(false)) {
            // Get the set section
            ConfigurationSection setSection = setsSection.getConfigurationSection(key);
            CommandSet set = loadSet(key, setSection, commands);
            if (set == null) {
                log(Level.WARNING, "Invalid set configuration for set '" + key + "'. Skipping.");
                continue;
            }
            sets.put(key, set);

            // Add the commands to our mapping
            for (String cmd : set.getCommands()) {
                commands.put(cmd, set);
            }
        }
    }

    return new Map[]{sets, commands};
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号