CommandAPI 9.6.0
An API for the command UI introduced in Minecraft 1.13
|
An exception for a syntax error that occurred while parsing or executing a command. More...
Public Member Functions | |
CommandSyntaxException (final CommandExceptionType type, final Message message) | |
Creates a new CommandSyntaxException of a given type and with a given message. More... | |
CommandSyntaxException (final CommandExceptionType type, final Message message, final String input, final int cursor) | |
Creates a new CommandSyntaxException of a given type and message together with the input and cursor position. More... | |
String | getMessage () |
Returns the message together with the position it occurred on and some context. More... | |
Message | getRawMessage () |
Returns the raw message, not including positional information. More... | |
String | getContext () |
Returns some contextual information about where the error occurred. More... | |
CommandExceptionType | getType () |
Returns the type of the exception. More... | |
String | getInput () |
Returns the input that caused the CommandSyntaxException. More... | |
int | getCursor () |
Returns the cursor position. More... | |
Static Public Attributes | |
static final int | CONTEXT_AMOUNT = 10 |
The amount of characters from the input that should be displayed in the getContext() . | |
static boolean | ENABLE_COMMAND_STACK_TRACES = true |
Enables suppression as defined in Exception#Exception(String, Throwable, boolean, boolean) , i.e. More... | |
static BuiltInExceptionProvider | BUILT_IN_EXCEPTIONS = new BuiltInExceptions() |
An exception for a syntax error that occurred while parsing or executing a command.
TODO: Why is this named syntax exception, when it can also occur when executing a command?
com.mojang.brigadier.exceptions.CommandSyntaxException.CommandSyntaxException | ( | final CommandExceptionType | type, |
final Message | message | ||
) |
Creates a new CommandSyntaxException of a given type and with a given message.
type | the type of the exception |
message | the message |
com.mojang.brigadier.exceptions.CommandSyntaxException.CommandSyntaxException | ( | final CommandExceptionType | type, |
final Message | message, | ||
final String | input, | ||
final int | cursor | ||
) |
Creates a new CommandSyntaxException of a given type and message together with the input and cursor position.
type | the type of the exception |
message | the message |
input | the input that caused the exception |
cursor | the cursor position the exception occurred on |
String com.mojang.brigadier.exceptions.CommandSyntaxException.getContext | ( | ) |
Returns some contextual information about where the error occurred.
This is done by returning a few characters ({@value CONTEXT_AMOUNT}) of the faulty getInput()
and a pointer to where the exception happened.
getInput()
or getCursor()
are null/0. int com.mojang.brigadier.exceptions.CommandSyntaxException.getCursor | ( | ) |
Returns the cursor position.
String com.mojang.brigadier.exceptions.CommandSyntaxException.getInput | ( | ) |
Returns the input that caused the CommandSyntaxException.
String com.mojang.brigadier.exceptions.CommandSyntaxException.getMessage | ( | ) |
Returns the message together with the position it occurred on and some context.
Message com.mojang.brigadier.exceptions.CommandSyntaxException.getRawMessage | ( | ) |
Returns the raw message, not including positional information.
CommandExceptionType com.mojang.brigadier.exceptions.CommandSyntaxException.getType | ( | ) |
Returns the type of the exception.
|
static |
Enables suppression as defined in Exception#Exception(String, Throwable, boolean, boolean)
, i.e.
whether to ignore calls to Exception#addSuppressed(Throwable)
. Additionally it is also used as the second boolean in the constructor mentioned above, i.e. specifies whether the stack trace is writable.