Class ListArgument
java.lang.Object
me.lucyy.squirtgun.command.argument.AbstractArgument<java.lang.String>
me.lucyy.squirtgun.command.argument.ListArgument
- All Implemented Interfaces:
CommandArgument<java.lang.String>
public class ListArgument extends AbstractArgument<java.lang.String>
An argument that accepts a single string from a list.
-
Constructor Summary
Constructors Constructor Description ListArgument(java.lang.String name, java.lang.String description, boolean isOptional, java.util.List<java.lang.String> values) -
Method Summary
Modifier and Type Method Description java.lang.StringgetValue(java.util.Queue<java.lang.String> args)Reads from a queue to get the value for this argument.@Nullable java.util.List<java.lang.String>tabComplete(java.util.Queue<java.lang.String> value)Tab-completes this node.Methods inherited from class me.lucyy.squirtgun.command.argument.AbstractArgument
getDescription, getName, isOptional, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
ListArgument
public ListArgument(java.lang.String name, java.lang.String description, boolean isOptional, java.util.List<java.lang.String> values)- Parameters:
name- this argument's namedescription- this argument's descriptionisOptional- whether this argument will be displayed as optionalvalues- a set of acceptable values for this argument
-
-
Method Details
-
getValue
public java.lang.String getValue(java.util.Queue<java.lang.String> args)Description copied from interface:CommandArgumentReads from a queue to get the value for this argument.- Parameters:
args- a queue of strings containing the raw arguments. Pop as many as needed and no more.- Returns:
- the parsed string value of this argument.
-
tabComplete
@Nullable public @Nullable java.util.List<java.lang.String> tabComplete(java.util.Queue<java.lang.String> value)Description copied from interface:CommandArgumentTab-completes this node.- Parameters:
value- a queue of strings containing the raw arguments. Pop as many as needed and no more.- Returns:
- the tabcompleted value of this node, or if not applicable, null
-