Adventure

Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Yannick Lamprecht <yannicklamprecht@live.de>
This commit is contained in:
Riley Park
2021-01-29 17:21:55 +01:00
parent 8888031206
commit 15081a5912
70 changed files with 3298 additions and 160 deletions

View File

@@ -126,4 +126,34 @@ public interface Permissible extends ServerOperator {
*/
@NotNull
public Set<PermissionAttachmentInfo> getEffectivePermissions();
// Paper start - add TriState permission checks
/**
* Checks if this object has a permission set and, if it is set, the value of the permission.
*
* @param permission the permission to check
* @return a tri-state of if the permission is set and, if it is set, it's value
*/
default net.kyori.adventure.util.@NotNull TriState permissionValue(final @NotNull Permission permission) {
if (this.isPermissionSet(permission)) {
return net.kyori.adventure.util.TriState.byBoolean(this.hasPermission(permission));
} else {
return net.kyori.adventure.util.TriState.NOT_SET;
}
}
/**
* Checks if this object has a permission set and, if it is set, the value of the permission.
*
* @param permission the permission to check
* @return a tri-state of if the permission is set and, if it is set, it's value
*/
default net.kyori.adventure.util.@NotNull TriState permissionValue(final @NotNull String permission) {
if (this.isPermissionSet(permission)) {
return net.kyori.adventure.util.TriState.byBoolean(this.hasPermission(permission));
} else {
return net.kyori.adventure.util.TriState.NOT_SET;
}
}
// Paper end
}