public final class StringParameterType extends java.lang.Object implements ParameterType<CommandActor,java.lang.String>
ParameterType for parsing String typesParameterType.Factory<A extends CommandActor>| Modifier and Type | Method and Description |
|---|---|
static <A extends CommandActor> |
greedy() |
boolean |
isGreedy()
Returns whether this parameter is greedy or not.
|
java.lang.String |
parse(@NotNull MutableStringStream input,
@NotNull ExecutionContext<CommandActor> context)
Reads input from the given
MutableStringStream, parses the object, or throws
exceptions if needed. |
@NotNull PrioritySpec |
parsePriority()
The priority for an argument of this type over other candidate arguments.
|
static <A extends CommandActor> |
single() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdefaultSuggestions@NotNull public static <A extends CommandActor> @NotNull ParameterType<A,java.lang.String> greedy()
@NotNull public static <A extends CommandActor> @NotNull ParameterType<A,java.lang.String> single()
public java.lang.String parse(@NotNull
@NotNull MutableStringStream input,
@NotNull
@NotNull ExecutionContext<CommandActor> context)
ParameterTypeMutableStringStream, 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)parse in interface ParameterType<CommandActor,java.lang.String>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 resolvedpublic boolean isGreedy()
ParameterTypeisGreedy in interface ParameterType<CommandActor,java.lang.String>@NotNull public @NotNull PrioritySpec parsePriority()
ParameterTypeAn 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
parsePriority in interface ParameterType<CommandActor,java.lang.String>PrioritySpec