mirror of
https://github.com/PaperMC/Velocity.git
synced 2026-02-17 14:37:43 +01:00
expose PermissionChecker and use this
This commit is contained in:
@@ -22,7 +22,7 @@ public interface PermissionSubject {
|
||||
* @return whether or not the subject has the permission
|
||||
*/
|
||||
default boolean hasPermission(String permission) {
|
||||
return getPermissionValue(permission).toBooleanOrElse(false);
|
||||
return this.getPermissionChecker().test(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,14 +31,14 @@ public interface PermissionSubject {
|
||||
* @param permission the permission
|
||||
* @return the value the permission is set to
|
||||
*/
|
||||
TriState getPermissionValue(String permission);
|
||||
default TriState getPermissionValue(String permission) {
|
||||
return this.getPermissionChecker().value(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the permission checker for the subject.
|
||||
*
|
||||
* @return subject's permission checker
|
||||
*/
|
||||
default PermissionChecker getPermissionChecker() {
|
||||
return this::getPermissionValue;
|
||||
}
|
||||
PermissionChecker getPermissionChecker();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user