Update Account.hasPermission()

Add wildcard characters to permission nodes under the same namespace. (simple implementation)
This commit is contained in:
lhhxxxxx 2022-04-27 14:45:53 +08:00 committed by Melledy
parent 286ab545e9
commit eef216aea8

View File

@ -104,7 +104,10 @@ public class Account {
}
public boolean hasPermission(String permission) {
return this.permissions.contains(permission) || this.permissions.contains("*") ? true : false;
return this.permissions.contains(permission) ||
this.permissions.contains("*") ||
(this.permissions.contains("player") || this.permissions.contains("player.*")) && permission.startsWith("player.") ||
(this.permissions.contains("server") || this.permissions.contains("server.*")) && permission.startsWith("server.");
}
public boolean removePermission(String permission) {