Package dev.jorel.commandapi.arguments
Interface ArgumentSuggestions
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
This class represents suggestions for an argument.
ArgumentSuggestions objects are best
created using the static methods as opposed to functionally.-
Method Summary
Modifier and TypeMethodDescriptionstatic ArgumentSuggestionsempty()Suggest nothingstatic ArgumentSuggestionsmerge(ArgumentSuggestions... suggestions) Merge suggestions from multipleArgumentSuggestionstogetherstatic ArgumentSuggestionsstringCollection(Function<SuggestionInfo, Collection<String>> suggestions) Suggest a collection of strings as the result of a functionstatic ArgumentSuggestionsstringCollectionAsync(Function<SuggestionInfo, CompletableFuture<Collection<String>>> suggestions) Suggest a collection of strings asynchronouslystatic ArgumentSuggestionsSuggest hardcoded stringsstatic ArgumentSuggestionsstrings(Collection<String> suggestions) Suggest hardcoded stringsstatic ArgumentSuggestionsstrings(Function<SuggestionInfo, String[]> suggestions) Suggest an array of strings as the result of a functionstatic ArgumentSuggestionsstringsAsync(Function<SuggestionInfo, CompletableFuture<String[]>> suggestions) Suggest an array of strings asynchronouslystatic ArgumentSuggestionsstringsWithTooltips(IStringTooltip... suggestions) Suggest hardcoded strings with tooltipsstatic ArgumentSuggestionsstringsWithTooltips(Collection<IStringTooltip> suggestions) Suggest hardcoded strings with tooltipsstatic ArgumentSuggestionsstringsWithTooltips(Function<SuggestionInfo, IStringTooltip[]> suggestions) Suggest an array of strings with tooltips as the result of a functionstatic ArgumentSuggestionsstringsWithTooltipsAsync(Function<SuggestionInfo, CompletableFuture<IStringTooltip[]>> suggestions) Suggest an array of strings with tooltips asynchronouslystatic ArgumentSuggestionsstringsWithTooltipsCollection(Function<SuggestionInfo, Collection<IStringTooltip>> suggestions) Suggest a collection of strings with tooltips as the result of a functionstatic ArgumentSuggestionsstringsWithTooltipsCollectionAsync(Function<SuggestionInfo, CompletableFuture<Collection<IStringTooltip>>> suggestions) Suggest a collection of strings with tooltips asynchronouslyCompletableFuture<com.mojang.brigadier.suggestion.Suggestions>suggest(SuggestionInfo info, com.mojang.brigadier.suggestion.SuggestionsBuilder builder) Create aCompletableFutureresolving onto a brigadierSuggestionsobject.
-
Method Details
-
suggest
CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> suggest(SuggestionInfo info, com.mojang.brigadier.suggestion.SuggestionsBuilder builder) throws com.mojang.brigadier.exceptions.CommandSyntaxException Create aCompletableFutureresolving onto a brigadierSuggestionsobject.- Parameters:
info- The suggestions infobuilder- The BrigadierSuggestionsBuilderobject- Returns:
- a
CompletableFutureresolving onto a brigadierSuggestionsobject. - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException- if there is an error making suggestions
-
empty
Suggest nothing- Returns:
- an
ArgumentSuggestionsobject suggesting nothing.
-
strings
Suggest hardcoded strings- Parameters:
suggestions- array of hardcoded strings- Returns:
- an
ArgumentSuggestionsobject suggesting hardcoded strings
-
strings
Suggest hardcoded strings- Parameters:
suggestions- collection of hardcoded strings- Returns:
- an
ArgumentSuggestionsobject suggesting hardcoded strings
-
strings
Suggest an array of strings as the result of a function- Parameters:
suggestions- function providing the strings as an array- Returns:
- an
ArgumentSuggestionsobject suggesting the result of the function
-
stringCollection
static ArgumentSuggestions stringCollection(Function<SuggestionInfo, Collection<String>> suggestions) Suggest a collection of strings as the result of a function- Parameters:
suggestions- function providing the strings as a collection- Returns:
- an
ArgumentSuggestionsobject suggesting the result of the function
-
stringsAsync
static ArgumentSuggestions stringsAsync(Function<SuggestionInfo, CompletableFuture<String[]>> suggestions) Suggest an array of strings asynchronously- Parameters:
suggestions- function providing the array of strings asynchronously- Returns:
- an
ArgumentSuggestionsobject suggesting the result of the asynchronous function
-
stringCollectionAsync
static ArgumentSuggestions stringCollectionAsync(Function<SuggestionInfo, CompletableFuture<Collection<String>>> suggestions) Suggest a collection of strings asynchronously- Parameters:
suggestions- function providing the collection of strings asynchronously- Returns:
- an
ArgumentSuggestionsobject suggesting the result of the asynchronous function
-
stringsWithTooltips
Suggest hardcoded strings with tooltips- Parameters:
suggestions- collection of hardcoded strings with tooltips- Returns:
- an
ArgumentSuggestionsobject suggesting the hardcoded strings with tooltips
-
stringsWithTooltips
Suggest hardcoded strings with tooltips- Parameters:
suggestions- collection of hardcoded strings with tooltips- Returns:
- an
ArgumentSuggestionsobject suggesting the hardcoded strings with tooltips
-
stringsWithTooltips
static ArgumentSuggestions stringsWithTooltips(Function<SuggestionInfo, IStringTooltip[]> suggestions) Suggest an array of strings with tooltips as the result of a function- Parameters:
suggestions- function providing the array of strings with tooltips- Returns:
- an
ArgumentSuggestionsobject suggesting the result of the function
-
stringsWithTooltipsCollection
static ArgumentSuggestions stringsWithTooltipsCollection(Function<SuggestionInfo, Collection<IStringTooltip>> suggestions) Suggest a collection of strings with tooltips as the result of a function- Parameters:
suggestions- function providing the collection of strings with tooltips- Returns:
- an
ArgumentSuggestionsobject suggesting the result of the function
-
stringsWithTooltipsAsync
static ArgumentSuggestions stringsWithTooltipsAsync(Function<SuggestionInfo, CompletableFuture<IStringTooltip[]>> suggestions) Suggest an array of strings with tooltips asynchronously- Parameters:
suggestions- function providing the array of strings with tooltips asynchronously- Returns:
- an
ArgumentSuggestionsobject suggesting the result of the asynchronous function
-
stringsWithTooltipsCollectionAsync
static ArgumentSuggestions stringsWithTooltipsCollectionAsync(Function<SuggestionInfo, CompletableFuture<Collection<IStringTooltip>>> suggestions) Suggest a collection of strings with tooltips asynchronously- Parameters:
suggestions- function providing the collection of strings with tooltips asynchronously- Returns:
- an
ArgumentSuggestionsobject suggesting the result of the asynchronous function
-
merge
Merge suggestions from multipleArgumentSuggestionstogether- Parameters:
suggestions- TheArgumentSuggestionsto be merged- Returns:
- an
ArgumentSuggestionsobject suggesting everything suggested by the input suggestions
-