Class CustomArgument.CustomArgumentException

java.lang.Object
java.lang.Throwable
java.lang.Exception
dev.jorel.commandapi.arguments.CustomArgument.CustomArgumentException
All Implemented Interfaces:
Serializable
Enclosing class:
CustomArgument<T,B>

public static class CustomArgument.CustomArgumentException extends Exception
An exception used to create command-related errors for the CustomArgument
Since:
2.0
See Also:
  • Method Details

    • fromString

      public static CustomArgument.CustomArgumentException fromString(String errorMessage)
      Constructs a CustomArgumentException with a given error message
      Parameters:
      errorMessage - the error message to display to the user when this exception is thrown
    • fromAdventureComponent

      public static CustomArgument.CustomArgumentException fromAdventureComponent(net.kyori.adventure.text.ComponentLike errorMessage)
      Constructs a CustomArgumentException with a given error message
      Parameters:
      errorMessage - the error message to display to the user when this exception is thrown
    • fromMessageBuilder

      public static CustomArgument.CustomArgumentException fromMessageBuilder(CustomArgument.MessageBuilder errorMessage)
      Constructs a CustomArgumentException with a given error message
      Parameters:
      errorMessage - the error message to display to the user when this exception is thrown
    • toCommandSyntax

      public com.mojang.brigadier.exceptions.CommandSyntaxException toCommandSyntax(String result, com.mojang.brigadier.context.CommandContext<?> cmdCtx)
      Converts this CustomArgumentException into a CommandSyntaxException
      Parameters:
      result - the argument that the user entered that caused this exception to arise
      cmdCtx - the command context that executed this command
      Returns:
      a Brigadier CommandSyntaxException