Skip to content

Commit

Permalink
Fix ScanObject Array Parser
Browse files Browse the repository at this point in the history
  • Loading branch information
ben9964 committed Sep 11, 2024
1 parent 269aa5d commit da80fcd
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ public ScanObjectArrayParser(ParserParameters options) {
@Override
public ArgumentParseResult<ScanObject<?>[]> parse(CommandContext<C> ctx, CommandInput input) {
try {
int queueSize = input.length();
// Find the index of the first item in the *actual* input
// input.input() is the entire command
int indexOf = input.input().indexOf(input.peekString());

// Find the number of elements that need to be in the array
int queueSize = input.input().substring(indexOf).split(" ").length;

List<ScanObject<?>> items = new ArrayList<>(queueSize);
for (var i = 0; i < (queueSize - 1); i++) {
items.add(ScanObject.parse(input.peekString()));
Expand Down

0 comments on commit da80fcd

Please sign in to comment.