diff --git a/proxy/src/main/java/net/md_5/bungee/config/YamlConfig.java b/proxy/src/main/java/net/md_5/bungee/config/YamlConfig.java index e36b9dfa7..d288ee80f 100644 --- a/proxy/src/main/java/net/md_5/bungee/config/YamlConfig.java +++ b/proxy/src/main/java/net/md_5/bungee/config/YamlConfig.java @@ -46,7 +46,7 @@ public class YamlConfig implements ConfigurationAdapter if (config == null) { - config = new LinkedHashMap<>(); + config = new HashMap(); } loaded = true; @@ -54,6 +54,25 @@ public class YamlConfig implements ConfigurationAdapter { throw new RuntimeException("Could not load configuration!", ex); } + + Map permissions = get("permissions", new HashMap()); + if (permissions.isEmpty()) + { + permissions.put("default", Arrays.asList(new String[] + { + "bungeecord.command.server", "bungeecord.command.list" + })); + permissions.put("admin", Arrays.asList(new String[] + { + "bungeecord.command.alert", "bungeecord.command.end", "bungeecord.command.ip", "bungeecord.command.reload" + })); + } + + Map groups = get("groups", new HashMap()); + if (groups.isEmpty()) + { + groups.put("md_5", Collections.singletonList("admin")); + } } private T get(String path, T def) @@ -87,7 +106,7 @@ public class YamlConfig implements ConfigurationAdapter } else { String first = path.substring(0, index); - String second = path.substring(index, path.length()); + String second = path.substring(index + 1, path.length()); Map sub = (Map) submap.get(first); return (sub != null) ? get(second, def, sub) : def; } @@ -172,7 +191,7 @@ public class YamlConfig implements ConfigurationAdapter @SuppressWarnings("unchecked") public Collection getGroups(String player) { - return get("groups." + player, Collections.EMPTY_SET); + return get("groups." + player, Collections.singleton("default")); } @Override