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
See Also:
  • Constructor Details

    • CustomArgumentException

      @Deprecated(since="9.0.1", forRemoval=true) public CustomArgumentException(net.md_5.bungee.api.chat.BaseComponent[] errorMessage)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructs a CustomArgumentException with a given error message
      Parameters:
      errorMessage - the error message to display to the user when this exception is thrown
    • CustomArgumentException

      @Deprecated(since="9.0.1", forRemoval=true) public CustomArgumentException(String errorMessage)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use fromString(String) instead
      Constructs a CustomArgumentException with a given error message
      Parameters:
      errorMessage - the error message to display to the user when this exception is thrown
    • CustomArgumentException

      @Deprecated(since="9.0.1", forRemoval=true) public CustomArgumentException(CustomArgument.MessageBuilder errorMessage)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructs a CustomArgumentException with a given error message
      Parameters:
      errorMessage - the error message to display to the user when this exception is thrown
  • Method Details

    • fromBaseComponents

      public static CustomArgument.CustomArgumentException fromBaseComponents(net.md_5.bungee.api.chat.BaseComponent[] errorMessage)
      Constructs a CustomArgumentException with a given error message
      Parameters:
      errorMessage - the error message to display to the user when this exception is thrown
    • 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.Component 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