CommandAPI 9.6.0
An API for the command UI introduced in Minecraft 1.13
com.mojang.brigadier.suggestion.SuggestionsBuilder Class Reference

A builder to simplify creating Suggestions instances. More...

Public Member Functions

 SuggestionsBuilder (final String input, final String inputLowerCase, final int start)
 
 SuggestionsBuilder (final String input, final int start)
 
String getInput ()
 Returns the full input this builder was created with. More...
 
int getStart ()
 Returns the start index of the suggestions in the input. More...
 
String getRemaining ()
 Returns the text that remains untouched by the suggestions. More...
 
String getRemainingLowerCase ()
 Returns the text that remains untouched by the suggestions in lowercase. More...
 
Suggestions build ()
 Builds a Suggestions instance based on this builder. More...
 
CompletableFuture< SuggestionsbuildFuture ()
 Builds the suggestions and returns the result in a future that instantly completes. More...
 
SuggestionsBuilder suggest (final String text)
 Suggests some replacement text for the entire range from getStart() to the end. More...
 
SuggestionsBuilder suggest (final String text, final Message tooltip)
 Suggests some replacement text for the entire range from getStart() to the end and provides a user readable tooltip. More...
 
SuggestionsBuilder suggest (final int value)
 Suggests some replacement integer for the entire range from getStart() to the end. More...
 
SuggestionsBuilder suggest (final int value, final Message tooltip)
 Suggests some replacement integer for the entire range from getStart() to the end and provides a user readable tooltip. More...
 
SuggestionsBuilder add (final SuggestionsBuilder other)
 Adds all suggestions from another SuggestionsBuilder. More...
 
SuggestionsBuilder createOffset (final int start)
 Create a new SuggestionsBuilder for the same input but a new start index. More...
 
SuggestionsBuilder restart ()
 Creates a builder with the same input and start index but no suggestions. More...
 

Detailed Description

A builder to simplify creating Suggestions instances.

Member Function Documentation

◆ add()

SuggestionsBuilder com.mojang.brigadier.suggestion.SuggestionsBuilder.add ( final SuggestionsBuilder  other)

Adds all suggestions from another SuggestionsBuilder.

Parameters
otherthe other builder
Returns
this builder

◆ build()

Suggestions com.mojang.brigadier.suggestion.SuggestionsBuilder.build ( )

Builds a Suggestions instance based on this builder.

Returns
a Suggestions instance based on this builder

◆ buildFuture()

CompletableFuture< Suggestions > com.mojang.brigadier.suggestion.SuggestionsBuilder.buildFuture ( )

Builds the suggestions and returns the result in a future that instantly completes.

Returns
a future for the built Suggestions

◆ createOffset()

SuggestionsBuilder com.mojang.brigadier.suggestion.SuggestionsBuilder.createOffset ( final int  start)

Create a new SuggestionsBuilder for the same input but a new start index.

Parameters
startthe new start index
Returns
the new builder with the same input, no suggestions and starting at start

◆ getInput()

String com.mojang.brigadier.suggestion.SuggestionsBuilder.getInput ( )

Returns the full input this builder was created with.

Returns
the input

◆ getRemaining()

String com.mojang.brigadier.suggestion.SuggestionsBuilder.getRemaining ( )

Returns the text that remains untouched by the suggestions.

Returns
the text that remains untouched by the suggestions

◆ getRemainingLowerCase()

String com.mojang.brigadier.suggestion.SuggestionsBuilder.getRemainingLowerCase ( )

Returns the text that remains untouched by the suggestions in lowercase.

Returns
the text that remains untouched by the suggestions in lowercase

◆ getStart()

int com.mojang.brigadier.suggestion.SuggestionsBuilder.getStart ( )

Returns the start index of the suggestions in the input.

Returns
the start index of the suggestions in the input

◆ restart()

SuggestionsBuilder com.mojang.brigadier.suggestion.SuggestionsBuilder.restart ( )

Creates a builder with the same input and start index but no suggestions.

It effectively creates a copy with nothing set, hence the term "restart".

Returns
the new builder with the same input and start index, but no suggestions
See also
createOffset

◆ suggest() [1/4]

SuggestionsBuilder com.mojang.brigadier.suggestion.SuggestionsBuilder.suggest ( final int  value)

Suggests some replacement integer for the entire range from getStart() to the end.

Parameters
valuethe value to suggest
Returns
this builder

◆ suggest() [2/4]

SuggestionsBuilder com.mojang.brigadier.suggestion.SuggestionsBuilder.suggest ( final int  value,
final Message  tooltip 
)

Suggests some replacement integer for the entire range from getStart() to the end and provides a user readable tooltip.

Parameters
valuethe integer to suggest
tooltipthe tooltip to add to the suggestion
Returns
this builder

◆ suggest() [3/4]

SuggestionsBuilder com.mojang.brigadier.suggestion.SuggestionsBuilder.suggest ( final String  text)

Suggests some replacement text for the entire range from getStart() to the end.

Parameters
textthe text to suggest
Returns
this builder

◆ suggest() [4/4]

SuggestionsBuilder com.mojang.brigadier.suggestion.SuggestionsBuilder.suggest ( final String  text,
final Message  tooltip 
)

Suggests some replacement text for the entire range from getStart() to the end and provides a user readable tooltip.

Parameters
textthe text to suggest
tooltipthe tooltip to add to the suggestion
Returns
this builder