Package dev.polv.taleapi.command
Class CommandNode.ArgumentNode<V>
java.lang.Object
dev.polv.taleapi.command.CommandNode<CommandNode.ArgumentNode<V>>
dev.polv.taleapi.command.CommandNode.ArgumentNode<V>
- Type Parameters:
V- the parsed value type
- Enclosing class:
- CommandNode<T extends CommandNode<T>>
An argument command node that parses typed input.
Arguments have a name used to retrieve parsed values and a type that defines how to parse input.
-
Nested Class Summary
Nested classes/interfaces inherited from class dev.polv.taleapi.command.CommandNode
CommandNode.ArgumentNode<V>, CommandNode.LiteralNode -
Field Summary
Fields inherited from class dev.polv.taleapi.command.CommandNode
children, executor, name, requirement -
Constructor Summary
ConstructorsConstructorDescriptionArgumentNode(String name, ArgumentType<V> type) Creates a new argument node with the given name and type. -
Method Summary
Modifier and TypeMethodDescriptionReturns the custom suggestion provider, if any.getType()Returns the argument type.Returns the usage string for this node.listSuggestions(CommandContext context, SuggestionsBuilder builder) Provides suggestions for autocompletion.suggests(SuggestionProvider provider) Sets a custom suggestion provider for this argument.toString()Methods inherited from class dev.polv.taleapi.command.CommandNode
argument, canUse, executes, getChildren, getExecutor, getName, getRequirement, isExecutable, literal, requires, requires, then
-
Constructor Details
-
ArgumentNode
Creates a new argument node with the given name and type.- Parameters:
name- the name of this argument nodetype- the argument type for parsing
-
-
Method Details
-
getType
Returns the argument type.- Returns:
- the type
-
getSuggestionProvider
Returns the custom suggestion provider, if any.- Returns:
- the suggestion provider, or null
-
suggests
Sets a custom suggestion provider for this argument.- Parameters:
provider- the suggestion provider- Returns:
- this node for chaining
-
getUsageText
Description copied from class:CommandNodeReturns the usage string for this node.- Specified by:
getUsageTextin classCommandNode<CommandNode.ArgumentNode<V>>- Returns:
- the usage representation
-
listSuggestions
public CompletableFuture<Suggestions> listSuggestions(CommandContext context, SuggestionsBuilder builder) Description copied from class:CommandNodeProvides suggestions for autocompletion.- Specified by:
listSuggestionsin classCommandNode<CommandNode.ArgumentNode<V>>- Parameters:
context- the command contextbuilder- the suggestions builder- Returns:
- a future with suggestions
-
toString
-