Skip to content

Commit

Permalink
update CategoryPermission
Browse files Browse the repository at this point in the history
  • Loading branch information
Revxrsal committed Jul 14, 2022
1 parent 87f6dc1 commit 28341f9
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public void parent(BaseCommandCategory cat) {
cat.categories.put(path, this);
}

/**
* Category permission: They have access to the category if they have
* access to any of its commands or other categories.
*/
private class CategoryPermission implements CommandPermission {

@Override public boolean canExecute(@NotNull CommandActor actor) {
Expand All @@ -97,7 +101,9 @@ private class CategoryPermission implements CommandPermission {
for (CommandCategory category : categories.values())
if (category.getPermission().canExecute(actor))
return true;
return defaultAction == null || defaultAction.hasPermission(actor);
if (defaultAction == null)
return false;
return defaultAction.hasPermission(actor);
}
}

Expand Down

0 comments on commit 28341f9

Please sign in to comment.