From a67d4a1697312b2fa8b41ac6893336d0bef2d81d Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 12 Apr 2013 19:41:20 +1000 Subject: [PATCH] Case shouldn't really matter for groups and permissions --- .../src/main/java/net/md_5/bungee/UserConnection.java | 10 +++++----- .../main/java/net/md_5/bungee/config/YamlConfig.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index 5f2e929e..bdbf5318 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -224,7 +224,7 @@ public final class UserConnection implements ProxiedPlayer { for ( String group : groups ) { - playerGroups.add( group ); + playerGroups.add( group.toLowerCase() ); for ( String permission : bungee.getConfigurationAdapter().getPermissions( group ) ) { setPermission( permission, true ); @@ -238,7 +238,7 @@ public final class UserConnection implements ProxiedPlayer { for ( String group : groups ) { - playerGroups.remove( group ); + playerGroups.remove( group.toLowerCase() ); for ( String permission : bungee.getConfigurationAdapter().getPermissions( group ) ) { setPermission( permission, false ); @@ -250,7 +250,7 @@ public final class UserConnection implements ProxiedPlayer @Synchronized("permMutex") public boolean hasPermission(String permission) { - return bungee.getPluginManager().callEvent( new PermissionCheckEvent( this, permission, permissions.contains( permission ) ) ).hasPermission(); + return bungee.getPluginManager().callEvent( new PermissionCheckEvent( this, permission, permissions.contains( permission.toLowerCase() ) ) ).hasPermission(); } @Override @@ -259,10 +259,10 @@ public final class UserConnection implements ProxiedPlayer { if ( value ) { - permissions.add( permission ); + permissions.add( permission.toLowerCase() ); } else { - permissions.remove( permission ); + permissions.remove( permission.toLowerCase() ); } } 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 e3d779c6..5985d29a 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 @@ -201,7 +201,7 @@ public class YamlConfig implements ConfigurationAdapter @SuppressWarnings("unchecked") public Collection getGroups(String player) { - Collection groups = get( "groups." + player, null ); + Collection groups = get( "groups." + player.toLowerCase(), null ); Collection ret = ( groups == null ) ? new HashSet() : new HashSet<>( groups ); ret.add( "default" ); return ret; @@ -211,6 +211,6 @@ public class YamlConfig implements ConfigurationAdapter @SuppressWarnings("unchecked") public Collection getPermissions(String group) { - return get( "permissions." + group, Collections.EMPTY_LIST ); + return get( "permissions." + group.toLowerCase(), Collections.EMPTY_LIST ); } }