🐛 Fix optionals not being brig executors

This commit is contained in:
jmp 2020-10-22 01:05:49 -07:00 committed by Alexander Söderberg
parent c9d4f39612
commit c74ac64e5f
2 changed files with 6 additions and 0 deletions

View file

@ -427,6 +427,9 @@ public final class CloudBrigadierManager<C, S> {
if (forceExecutor || root.isLeaf() || !root.getValue().isRequired()) {
argumentBuilder.executes(executor);
}
if (root.getChildren().stream().noneMatch(node -> node.getValue().isRequired())) {
argumentBuilder.executes(executor);
}
for (final CommandTree.Node<CommandArgument<C, ?>> node : root.getChildren()) {
argumentBuilder.then(constructCommandNode(forceExecutor, node, permissionChecker, executor, suggestionProvider));
}