Skip to content

Commit

Permalink
Hotfix #310 for 8.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
JorelAli committed Dec 19, 2022
1 parent 916a494 commit 9c93292
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,18 @@ public class CommandAPIHandler<CommandSourceStack> {
*/
public static <CommandSourceStack> String getRawArgumentInput(CommandContext<CommandSourceStack> cmdCtx,
String key) {
StringRange range = ((Map<String, ParsedArgument<CommandSourceStack, ?>>) COMMANDCONTEXT_ARGUMENTS.get(cmdCtx))
.get(key).getRange();
return cmdCtx.getInput().substring(range.getStart(), range.getEnd());
final Map<String, ParsedArgument<CommandSourceStack, ?>> commandContextArgs = (Map<String, ParsedArgument<CommandSourceStack, ?>>) COMMANDCONTEXT_ARGUMENTS.get(cmdCtx);
final ParsedArgument<CommandSourceStack, ?> parsedArgument = commandContextArgs.get(key);

// TODO: Issue #310: Parsing this argument via /execute run <blah> doesn't have the value in
// the arguments for this command context (most likely because it's a redirected command).
// We need to figure out how to handle this case.
if(parsedArgument != null) {
StringRange range = parsedArgument.getRange();
return cmdCtx.getInput().substring(range.getStart(), range.getEnd());
} else {
return "";
}
}

private static CommandAPIHandler<?> instance;
Expand Down

0 comments on commit 9c93292

Please sign in to comment.