Skip to content

Commit

Permalink
Handle all aggregates not just compound
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Jan 22, 2024
1 parent 453dc82 commit 22e8ba7
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import cloud.commandframework.CommandComponent;
import cloud.commandframework.arguments.LiteralParser;
import cloud.commandframework.arguments.compound.CompoundParser;
import cloud.commandframework.arguments.aggregate.AggregateParser;
import cloud.commandframework.internal.CommandNode;
import cloud.commandframework.permission.Permission;
import cloud.commandframework.types.tuples.Pair;
Expand Down Expand Up @@ -136,9 +136,8 @@ private void addChildren(final CommandTreeNode<?> node, final CommandNode<C> clo
final CommandTreeNode.Argument<? extends CommandTreeNode.Argument<?>> treeNode;
if (value.parser() instanceof LiteralParser) {
treeNode = (CommandTreeNode.Argument<? extends CommandTreeNode.Argument<?>>) CommandTreeNode.literal();
} else if (value.parser() instanceof CompoundParser) {
final CompoundParser<?, C, ?> compound = (CompoundParser<?, C, ?>) value.parser();
this.handleCompoundArgument(node, child, compound);
} else if (value.parser() instanceof AggregateParser<C, ?> aggregate) {
this.handleAggregate(node, child, aggregate);
continue;
} else {
treeNode = this.commandManager.parserMapper().mapComponent(value);
Expand All @@ -152,10 +151,10 @@ private void addChildren(final CommandTreeNode<?> node, final CommandNode<C> clo
}
}

private void handleCompoundArgument(
private void handleAggregate(
final CommandTreeNode<?> node,
final CommandNode<C> child,
final CompoundParser<?, C, ?> compound
final AggregateParser<C, ?> compound
) {
final CommandTreeNode.Argument<? extends CommandTreeNode.Argument<?>> treeNode;
final ArrayDeque<Pair<String, CommandTreeNode.Argument<? extends CommandTreeNode.Argument<?>>>> nodes = new ArrayDeque<>();
Expand Down

0 comments on commit 22e8ba7

Please sign in to comment.