A - The actor typeT - The parameter type@FunctionalInterface public interface ParameterType<A extends CommandActor,T> extends BaseParameterType
MutableStringStream.
A parameter type is allowed to consume as much of the MutableStringStream as needed,
however, it may not consume parts of strings. If it needs to consume a
single string, it must consume it entirely.
Note that Lamp will automatically register resolvers for the following types:
List<T> for any parameter type TSet<T> for any parameter type TT[] for any parameter type Tints, doubles, booleans, chars, etc.)String type@ParseWith annotation.ParameterTypes,
@ParseWith| Modifier and Type | Interface and Description |
|---|---|
static interface |
ParameterType.Factory<A extends CommandActor>
Represents a factory that constructs
ParameterTypes dynamically |
| Modifier and Type | Method and Description |
|---|---|
default @NotNull SuggestionProvider<A> |
defaultSuggestions()
Returns the default suggestions.
|
default boolean |
isGreedy()
Returns whether this parameter is greedy or not.
|
T |
parse(@NotNull MutableStringStream input,
@NotNull ExecutionContext<A> context)
Reads input from the given
MutableStringStream, parses the object, or throws
exceptions if needed. |
default @NotNull PrioritySpec |
parsePriority()
The priority for an argument of this type over other candidate arguments.
|
T parse(@NotNull @NotNull MutableStringStream input, @NotNull @NotNull ExecutionContext<A> context)
MutableStringStream, parses the object, or throws
exceptions if needed.
Note: Lamp makes no guarantees about the times it may invoke this method. It may be called repeatedly for execution, tab completion, finding execution candidates, etc.
As such, it's important to implement the parse method with the following in mind:
CommandErrorException)input - The input stream. This argument type is free to consume as much as it needscontext - The command execution context, as well as arguments that have been resolved@NotNull default @NotNull SuggestionProvider<A> defaultSuggestions()
ParameterNode does not
supply any custom suggestions.@NotNull default @NotNull PrioritySpec parsePriority()
An example of this, is when a command has the following signatures:
Because an integer parameter can only accept a certain type of input (i.e. numbers),
it will have higher priority over a string parameter, and as such, if the user
inputs /foo 10, the integer will be tested first, before moving on to the
string.
For more details on the priority API, see PrioritySpec
PrioritySpecdefault boolean isGreedy()