diff --git a/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java b/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java index e15c24c14..4cfb13c02 100644 --- a/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java +++ b/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java @@ -83,23 +83,23 @@ public class YamlConfig implements ConfigurationAdapter throw new RuntimeException( "Could not load configuration!", ex ); } - Map permissions = get( "permissions", new HashMap() ); - if ( permissions.isEmpty() ) + Map permissions = get( "permissions", null ); + if ( permissions == null ) { - permissions.put( "default", Arrays.asList( new String[] + set( "permissions.default", Arrays.asList( new String[] { "bungeecord.command.server", "bungeecord.command.list" } ) ); - permissions.put( "admin", Arrays.asList( new String[] + set( "permissions.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() ) + Map groups = get( "groups", null ); + if ( groups == null ) { - groups.put( "md_5", Collections.singletonList( "admin" ) ); + set( "groups.md_5", Collections.singletonList( "admin" ) ); } } @@ -136,6 +136,11 @@ public class YamlConfig implements ConfigurationAdapter } } + private void set(String path, Object val) + { + set( path, val, config ); + } + @SuppressWarnings("unchecked") private void set(String path, Object val, Map submap) {