CommandAPI 9.3.0
An API for the command UI introduced in Minecraft 1.13
com.mojang.brigadier.suggestion.SuggestionProvider< S > Interface Template Reference

A provider that generates suggestions based on a context and adds them to a builder it then returns. More...

Public Member Functions

CompletableFuture< SuggestionsgetSuggestions (final CommandContext< S > context, final SuggestionsBuilder builder) throws CommandSyntaxException
 Computes suggestions for the given CommandContext and adds them to the given SuggestionsBuilder, which is then build and returned in the future. More...
 

Detailed Description

A provider that generates suggestions based on a context and adds them to a builder it then returns.

As looking up the suggestions might involve about anything, from querying game state to I/O, the method returns a CompletableFuture and no guarantees are made about its execution.

Parameters
<S>the type of the command source

Member Function Documentation

◆ getSuggestions()

CompletableFuture< Suggestions > com.mojang.brigadier.suggestion.SuggestionProvider< S >.getSuggestions ( final CommandContext< S >  context,
final SuggestionsBuilder  builder 
) throws CommandSyntaxException

Computes suggestions for the given CommandContext and adds them to the given SuggestionsBuilder, which is then build and returned in the future.

Parameters
contextthe command context to as a base
builderthe builder to add them to
Returns
a completable future that might complete sometime in the future, as computing the suggestions might involve arbitrary computations and even I/O
Exceptions
CommandSyntaxExceptionif an error occurs parsing the context to return a valid suggestion