Case shouldn't really matter for groups and permissions

This commit is contained in:
md_5 2013-04-12 19:41:20 +10:00
parent b87fff2614
commit a67d4a1697
2 changed files with 7 additions and 7 deletions

View File

@ -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() );
}
}

View File

@ -201,7 +201,7 @@ public class YamlConfig implements ConfigurationAdapter
@SuppressWarnings("unchecked")
public Collection<String> getGroups(String player)
{
Collection<String> groups = get( "groups." + player, null );
Collection<String> groups = get( "groups." + player.toLowerCase(), null );
Collection<String> ret = ( groups == null ) ? new HashSet<String>() : new HashSet<>( groups );
ret.add( "default" );
return ret;
@ -211,6 +211,6 @@ public class YamlConfig implements ConfigurationAdapter
@SuppressWarnings("unchecked")
public Collection<String> getPermissions(String group)
{
return get( "permissions." + group, Collections.EMPTY_LIST );
return get( "permissions." + group.toLowerCase(), Collections.EMPTY_LIST );
}
}