Package baritone.api.command.argument
Interface ICommandArgument
public interface ICommandArgument
A
ICommandArgument is an immutable object representing one command argument. It contains data on the index of
that argument, its value, and the rest of the string that argument was found in
You're recommended to use IArgConsumer}s to handle these.
- Since:
- 10/2/2019
- Author:
- Brady
-
Method Summary
Modifier and TypeMethodDescription<T> TTries to use a statelessIArgParserto parse this argument into the specified class<T,S> T Tries to use a statedIArgParserto parse this argument into the specified class<E extends Enum<?>>
EGets an enum value from the enum class with the same name as this argument's valueintgetIndex()getValue()<T> booleanTries to use a statelessIArgParserto parse this argument into the specified class<T,S> boolean Tries to use a statedIArgParserto parse this argument into the specified class
-
Method Details
-
getIndex
int getIndex()- Returns:
- The index of this command argument in the list of command arguments generated
-
getValue
- Returns:
- The raw value of just this argument
-
getRawRest
- Returns:
- The raw value of the remaining arguments after this one was captured
-
getEnum
Gets an enum value from the enum class with the same name as this argument's valueFor example if you getEnum as an
Direction, and this argument's value is "up", it will returnDirection.UP- Parameters:
enumClass- The enum class to search- Returns:
- An enum constant of that class with the same name as this argument's value
- Throws:
CommandInvalidTypeException- If the constant couldn't be found- See Also:
-
getAs
Tries to use a statelessIArgParserto parse this argument into the specified class- Parameters:
type- The class to parse this argument into- Returns:
- An instance of the specified type
- Throws:
CommandInvalidTypeException- If the parsing failed
-
is
Tries to use a statelessIArgParserto parse this argument into the specified class- Parameters:
type- The class to parse this argument into- Returns:
- If the parser succeeded
-
getAs
Tries to use a statedIArgParserto parse this argument into the specified class- Parameters:
type- The class to parse this argument into- Returns:
- An instance of the specified type
- Throws:
CommandInvalidTypeException- If the parsing failed
-
is
Tries to use a statedIArgParserto parse this argument into the specified class- Parameters:
type- The class to parse this argument into- Returns:
- If the parser succeeded
-