Mitigate some permissions confusion

For some reason, certain permissions plugins seem to not respect our declared default false nodes. To alleviate user confusion, these nodes will not be allowed to be used via wildcard internally.
This commit is contained in:
Jikoo 2020-09-15 13:44:50 -04:00
parent da55790fd2
commit 788f022e74

View file

@ -25,9 +25,9 @@ public enum Permissions {
EXEMPT("exempt"), EXEMPT("exempt"),
CROSSWORLD("crossworld"), CROSSWORLD("crossworld"),
SILENT("silent"), SILENT("silent"),
SILENT_DEFAULT("silent.default"), SILENT_DEFAULT("silent.default", true),
ANYCHEST("anychest"), ANYCHEST("anychest"),
ANY_DEFAULT("any.default"), ANY_DEFAULT("any.default", true),
ENDERCHEST("openender"), ENDERCHEST("openender"),
ENDERCHEST_ALL("openenderall"), ENDERCHEST_ALL("openenderall"),
SEARCH("search"), SEARCH("search"),
@ -39,15 +39,21 @@ public enum Permissions {
SPECTATE("spectate"); SPECTATE("spectate");
private final String permission; private final String permission;
private final boolean uninheritable;
Permissions(String permission) { Permissions(String permission) {
this(permission, false);
}
Permissions(String permission, boolean uninheritable) {
this.permission = "OpenInv." + permission; this.permission = "OpenInv." + permission;
this.uninheritable = uninheritable;
} }
public boolean hasPermission(Permissible permissible) { public boolean hasPermission(Permissible permissible) {
boolean hasPermission = permissible.hasPermission(permission); boolean hasPermission = permissible.hasPermission(permission);
if (hasPermission || permissible.isPermissionSet(permission)) { if (uninheritable || hasPermission || permissible.isPermissionSet(permission)) {
return hasPermission; return hasPermission;
} }