Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public final class LocationParser<C> implements ArgumentParser<C, Location>, Blo
)
);
}

final CommandInput originalInput = commandInput.copy();
final LocationCoordinate[] coordinates = new LocationCoordinate[3];
for (int i = 0; i < 3; i++) {
if (commandInput.peekString().isEmpty()) {
Expand Down Expand Up @@ -147,7 +147,7 @@ public final class LocationParser<C> implements ArgumentParser<C, Location>, Blo
new LocationParseException(
commandContext,
LocationParseException.FailureReason.MIXED_LOCAL_ABSOLUTE,
""
originalInput.remainingInput()
)
);
}
Expand Down Expand Up @@ -252,10 +252,19 @@ private static float toRadians(final float degrees) {
}


static class LocationParseException extends ParserException {
public static final class LocationParseException extends ParserException {

private final String input;
private final FailureReason reason;

protected LocationParseException(
/**
* Construct a new LocationParseException
*
* @param context Command context
* @param reason Failure reason
* @param input Input
*/
public LocationParseException(
final @NonNull CommandContext<?> context,
final @NonNull FailureReason reason,
final @NonNull String input
Expand All @@ -266,6 +275,26 @@ protected LocationParseException(
reason.caption(),
CaptionVariable.of("input", input)
);
this.input = input;
this.reason = reason;
}

/**
* Get the supplied input
*
* @return String value
*/
public @NonNull String input() {
return this.input;
}

/**
* Get the failure reason
*
* @return Failure reason
*/
public @NonNull FailureReason reason() {
return this.reason;
}


Expand Down