Package dev.jorel.commandapi.arguments
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>
An exception used to create command-related errors for the CustomArgument
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionfromBaseComponents(net.md_5.bungee.api.chat.BaseComponent[] errorMessage) Constructs a CustomArgumentException with a given error messagefromMessageBuilder(CustomArgument.MessageBuilder errorMessage) Constructs a CustomArgumentException with a given error messagefromString(String errorMessage) Constructs a CustomArgumentException with a given error messagecom.mojang.brigadier.exceptions.CommandSyntaxExceptiontoCommandSyntax(String result, com.mojang.brigadier.context.CommandContext<?> cmdCtx) Converts this CustomArgumentException into a CommandSyntaxExceptionMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
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
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 arisecmdCtx- the command context that executed this command- Returns:
- a Brigadier CommandSyntaxException
-