Added ArgumentValidationException as separate from illegal syntax
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
package net.minecraft.commands.tree;
|
||||
|
||||
import net.minecraft.commands.arguments.CommandArgumentType;
|
||||
import net.minecraft.commands.exceptions.IllegalCommandArgumentException;
|
||||
import net.minecraft.commands.exceptions.ArgumentValidationException;
|
||||
import net.minecraft.commands.exceptions.IllegalArgumentSyntaxException;
|
||||
|
||||
public class ArgumentCommandNode<T> extends CommandNode {
|
||||
private final String name;
|
||||
@@ -21,7 +22,7 @@ public class ArgumentCommandNode<T> extends CommandNode {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandNode parse(String command) throws IllegalCommandArgumentException {
|
||||
public CommandNode parse(String command) throws IllegalArgumentSyntaxException, ArgumentValidationException {
|
||||
CommandArgumentType.CommandArgumentParseResult<T> parsed = type.parse(command);
|
||||
int start = parsed.getRaw().length() + 1;
|
||||
|
||||
@@ -31,11 +32,11 @@ public class ArgumentCommandNode<T> extends CommandNode {
|
||||
for (CommandNode node : getChildren()) {
|
||||
try {
|
||||
return node.parse(result);
|
||||
} catch (IllegalCommandArgumentException ignored) {
|
||||
} catch (IllegalArgumentSyntaxException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalCommandArgumentException();
|
||||
throw new IllegalArgumentSyntaxException();
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package net.minecraft.commands.tree;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.commands.exceptions.IllegalCommandArgumentException;
|
||||
import net.minecraft.commands.exceptions.ArgumentValidationException;
|
||||
import net.minecraft.commands.exceptions.IllegalArgumentSyntaxException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,5 +17,5 @@ public abstract class CommandNode {
|
||||
children.add(node);
|
||||
}
|
||||
|
||||
public abstract CommandNode parse(String command) throws IllegalCommandArgumentException;
|
||||
public abstract CommandNode parse(String command) throws IllegalArgumentSyntaxException, ArgumentValidationException;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.minecraft.commands.tree;
|
||||
|
||||
import net.minecraft.commands.exceptions.IllegalCommandArgumentException;
|
||||
import net.minecraft.commands.exceptions.ArgumentValidationException;
|
||||
import net.minecraft.commands.exceptions.IllegalArgumentSyntaxException;
|
||||
|
||||
public class LiteralCommandNode extends CommandNode {
|
||||
private final String literal;
|
||||
@@ -20,7 +21,7 @@ public class LiteralCommandNode extends CommandNode {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandNode parse(String command) throws IllegalCommandArgumentException {
|
||||
public CommandNode parse(String command) throws IllegalArgumentSyntaxException, ArgumentValidationException {
|
||||
if (command.startsWith(literal)) {
|
||||
int start = literal.length() + 1;
|
||||
|
||||
@@ -30,16 +31,16 @@ public class LiteralCommandNode extends CommandNode {
|
||||
for (CommandNode node : getChildren()) {
|
||||
try {
|
||||
return node.parse(result);
|
||||
} catch (IllegalCommandArgumentException ignored) {
|
||||
} catch (IllegalArgumentSyntaxException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalCommandArgumentException();
|
||||
throw new IllegalArgumentSyntaxException();
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
} else {
|
||||
throw new IllegalCommandArgumentException();
|
||||
throw new IllegalArgumentSyntaxException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user