🐛 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

@ -26,6 +26,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Allow for combined presence flags, such that `-a -b -c` is equivalent to `-abc` - Allow for combined presence flags, such that `-a -b -c` is equivalent to `-abc`
- Allow for class annotations as a default for when an annotation is not present on a method. - Allow for class annotations as a default for when an annotation is not present on a method.
### Fixed
- Fix arguments with no required children not being executors (cloud-brigadier)
## [1.0.2] - 2020-10-18 ## [1.0.2] - 2020-10-18
### Fixed ### Fixed

View file

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