mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2024-12-23 00:15:08 +00:00
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:
parent
da55790fd2
commit
788f022e74
1 changed files with 9 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue