Fixed check for permissions not in the enum

This commit is contained in:
Daniel Saukel 2016-04-29 21:08:42 +02:00
parent 0ccbc58be1
commit eed8427eb1

View File

@ -153,6 +153,10 @@ public enum DPermissions {
* @return if the player has the permission
*/
public static boolean hasPermission(CommandSender sender, String permission) {
if (sender.hasPermission(permission)) {
return true;
}
DPermissions dPermission = null;
if (EnumUtil.isValidEnum(DPermissions.class, permission)) {
dPermission = DPermissions.valueOf(permission);
@ -165,7 +169,13 @@ public enum DPermissions {
return false;
}
return hasPermission(sender, dPermission);
for (DPermissions parent : DPermissions.values()) {
if (parent.getChildren().contains(dPermission) && sender.hasPermission(parent.getNode())) {
return true;
}
}
return false;
}
/**