Parse into nested arguments
This commit is contained in:
@@ -22,6 +22,23 @@ public class ArgumentCommandNode<T> extends CommandNode {
|
||||
|
||||
@Override
|
||||
public void parse(String command) throws IllegalCommandArgumentException {
|
||||
type.parse(command);
|
||||
CommandArgumentType.CommandArgumentParseResult<T> parsed = type.parse(command);
|
||||
int start = parsed.getRaw().length() + 1;
|
||||
|
||||
if (start < command.length()) {
|
||||
String result = command.substring(start);
|
||||
IllegalCommandArgumentException exception = new IllegalCommandArgumentException();
|
||||
|
||||
for (CommandNode node : getChildren()) {
|
||||
try {
|
||||
node.parse(result);
|
||||
return;
|
||||
} catch (IllegalCommandArgumentException ex) {
|
||||
exception = ex;
|
||||
}
|
||||
}
|
||||
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user