Merge pull request #245 from weaondara/master

add permission to check in PermissionCheckEvent
This commit is contained in:
md-5 2013-03-31 19:04:14 -07:00
commit d067662967
2 changed files with 6 additions and 1 deletions

View File

@ -23,6 +23,10 @@ public class PermissionCheckEvent extends Event
* The command sender being checked for a permission.
*/
private final CommandSender sender;
/**
* The permission to check.
*/
private final String permission;
/**
* The outcome of this permission check.
*/

View File

@ -92,6 +92,7 @@ public final class UserConnection implements ProxiedPlayer
public void setDisplayName(String name)
{
Preconditions.checkArgument( name.length() <= 16, "Display name cannot be longer than 16 characters" );
displayName=name;
bungee.getTabListHandler().onDisconnect( this );
bungee.getTabListHandler().onConnect( this );
}
@ -250,7 +251,7 @@ public final class UserConnection implements ProxiedPlayer
@Synchronized("permMutex")
public boolean hasPermission(String permission)
{
return bungee.getPluginManager().callEvent( new PermissionCheckEvent( this, permissions.contains( permission ) ) ).hasPermission();
return bungee.getPluginManager().callEvent( new PermissionCheckEvent( this, permission, permissions.contains( permission ) ) ).hasPermission();
}
@Override