Class WrapperCommandSyntaxException

java.lang.Object
java.lang.Throwable
java.lang.Exception
dev.jorel.commandapi.exceptions.WrapperCommandSyntaxException
All Implemented Interfaces:
Serializable

public class WrapperCommandSyntaxException extends Exception
A wrapper for the CommandSyntaxException so other developers don't have to import Mojang's brigadier
See Also:
  • Constructor Details

    • WrapperCommandSyntaxException

      public WrapperCommandSyntaxException(com.mojang.brigadier.exceptions.CommandSyntaxException exception)
      Creates a WrapperCommandSyntaxException
      Parameters:
      exception - the exception to wrap
  • Method Details

    • getException

      public com.mojang.brigadier.exceptions.CommandSyntaxException getException()
      Returns the wrapped CommandSyntaxException
      Returns:
      the wrapped CommandSyntaxException
    • getMessage

      public String getMessage()
      Returns the message together with the position it occurred on and some context.
      Overrides:
      getMessage in class Throwable
      Returns:
      the message together with the position it occurred on and some context
    • getCause

      public Throwable getCause()
      Overrides:
      getCause in class Throwable
    • getStackTrace

      public StackTraceElement[] getStackTrace()
      Overrides:
      getStackTrace in class Throwable
    • initCause

      public Throwable initCause(Throwable cause)
      Overrides:
      initCause in class Throwable
    • getLocalizedMessage

      public String getLocalizedMessage()
      Overrides:
      getLocalizedMessage in class Throwable
    • printStackTrace

      public void printStackTrace()
      Overrides:
      printStackTrace in class Throwable
    • printStackTrace

      public void printStackTrace(PrintStream s)
      Overrides:
      printStackTrace in class Throwable
    • printStackTrace

      public void printStackTrace(PrintWriter s)
      Overrides:
      printStackTrace in class Throwable
    • setStackTrace

      public void setStackTrace(StackTraceElement[] stackTrace)
      Overrides:
      setStackTrace in class Throwable
    • getRawMessage

      public com.mojang.brigadier.Message getRawMessage()
      Returns the raw message, not including positional information
      Returns:
      the raw message without any formatting or positional information
    • getContext

      public String getContext()
      Returns some contextual information about where the error occurred.

      This is done by returning a few characters (10) of the faulty getInput() and a pointer to where the exception happened.

      Returns:
      some contextual information about where the error occurred or null if getInput() or getCursor() are null/0.
    • getType

      public com.mojang.brigadier.exceptions.CommandExceptionType getType()
      Returns the type of the exception.
      Returns:
      the type of the exception
    • getInput

      public String getInput()
      Returns the input that caused the CommandSyntaxException.
      Returns:
      the input that caused the CommandSyntaxException or null if not set
    • getCursor

      public int getCursor()
      Returns the cursor position.
      Returns:
      the cursor position or -1 if not set