ConfigLoader.java 文件源码

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

项目:CommandTimer 作者:
/**
 * Loads all CommandSetGroups.
 *
 * @param config
 * @param sets
 * @return
 */
public static Map<String, CommandSetGroup> loadSetGroups(Configuration config, Map<String, CommandSet> sets) {
    Map<String, CommandSetGroup> groups = new HashMap<String, CommandSetGroup>();
    ConfigurationSection groupsSection = config.getConfigurationSection("groups");
    if (groupsSection != null) {
        for (String key : groupsSection.getKeys(false)) {
            // Get the group section
            ConfigurationSection groupSection = groupsSection.getConfigurationSection(key);

            CommandSetGroup group = loadSetGroup(key, groupSection, sets);
            if (group == null) {
                log(Level.WARNING, "Invalid group configuration for group '" + key + "'. Skipping.");
                continue;
            }

            groups.put(key, group);
        }
    }

    if (!groups.containsKey("default")) {
        log(Level.INFO, "There isn't a default group; creating one with no settings.");
        groups.put("default", new CommandSetGroup("default", new HashMap<CommandSet, Integer>(), new HashMap<CommandSet, Integer>()));
    }

    return groups;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号