Class SuggestionsBuilder
java.lang.Object
dev.polv.taleapi.command.suggestion.SuggestionsBuilder
Builder for creating
Suggestions.
Used by argument types to provide autocompletion suggestions.
-
Constructor Summary
ConstructorsConstructorDescriptionSuggestionsBuilder(String input, int start) Creates a new suggestions builder. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the suggestions.Builds the suggestions as a completed future.createOffset(int start) Creates a new builder with the same input but cleared suggestions.getInput()Returns the full input string.Returns the remaining portion of the input after the start position.Returns the remaining portion in lowercase.intgetStart()Returns the position where suggestions start.restart(int start) Creates a new builder restarting at the given position.suggest(int value) Adds an integer suggestion.Adds an integer suggestion with a tooltip.Adds multiple suggestions.Adds a suggestion.Adds a suggestion with a tooltip.
-
Constructor Details
-
SuggestionsBuilder
Creates a new suggestions builder.- Parameters:
input- the full input stringstart- the position where suggestions start
-
-
Method Details
-
getInput
Returns the full input string.- Returns:
- the input
-
getStart
public int getStart()Returns the position where suggestions start.- Returns:
- the start position
-
getRemaining
Returns the remaining portion of the input after the start position.- Returns:
- the remaining input
-
getRemainingLowerCase
Returns the remaining portion in lowercase.- Returns:
- the lowercase remaining input
-
suggest
Adds a suggestion.- Parameters:
text- the suggestion text- Returns:
- this builder
-
suggest
Adds a suggestion with a tooltip.- Parameters:
text- the suggestion texttooltip- the tooltip- Returns:
- this builder
-
suggest
Adds an integer suggestion.- Parameters:
value- the integer value- Returns:
- this builder
-
suggest
Adds an integer suggestion with a tooltip.- Parameters:
value- the integer valuetooltip- the tooltip- Returns:
- this builder
-
suggest
Adds multiple suggestions.- Parameters:
texts- the suggestion texts- Returns:
- this builder
-
build
Builds the suggestions.- Returns:
- the built suggestions
-
buildFuture
Builds the suggestions as a completed future.- Returns:
- a future containing the suggestions
-
restart
Creates a new builder restarting at the given position.- Parameters:
start- the new start position- Returns:
- a new builder
-
createOffset
Creates a new builder with the same input but cleared suggestions.- Parameters:
start- the new start position for suggestions- Returns:
- a new builder
-