Package dev.jorel.commandapi.arguments
Interface SafeSuggestions<S,CommandSender>
- Type Parameters:
S- the type of the suggestions
- 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 safe suggestions. These are parameterized suggestions which can be converted
into a string under a mapping function.
SafeSuggestions instances are best created using the static methods as opposed to functionally.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T,CommandSender>
SafeSuggestions<T, CommandSender> empty()Create an empty SafeSuggestions object.static <T,CommandSender>
SafeSuggestions<T, CommandSender> suggest(Collection<T> suggestions) Hardcode a collection of values to suggeststatic <T,CommandSender>
SafeSuggestions<T, CommandSender> suggest(Function<SuggestionInfo<CommandSender>, T[]> suggestions) Suggest an array of values as the result of a functionstatic <T,CommandSender>
SafeSuggestions<T, CommandSender> suggest(T... suggestions) Hardcode an array of values to suggeststatic <T,CommandSender>
SafeSuggestions<T, CommandSender> suggestAsync(Function<SuggestionInfo<CommandSender>, CompletableFuture<T[]>> suggestions) Suggest an array of values provided asynchronouslystatic <T,CommandSender>
SafeSuggestions<T, CommandSender> suggestCollection(Function<SuggestionInfo<CommandSender>, Collection<T>> suggestions) Suggest a collection of values as the result of a functionstatic <T,CommandSender>
SafeSuggestions<T, CommandSender> suggestCollectionAsync(Function<SuggestionInfo<CommandSender>, CompletableFuture<Collection<T>>> suggestions) Suggest a collection of values provided asynchronouslystatic <T,CommandSender>
SafeSuggestions<T, CommandSender> tooltipCollection(Function<SuggestionInfo<CommandSender>, Collection<Tooltip<T>>> suggestions) Suggest a collection of values with tooltips as the result of a functionstatic <T,CommandSender>
SafeSuggestions<T, CommandSender> tooltipCollectionAsync(Function<SuggestionInfo<CommandSender>, CompletableFuture<Collection<Tooltip<T>>>> suggestions) Suggest a collection of values with tooltips asynchronouslystatic <T,CommandSender>
SafeSuggestions<T, CommandSender> Suggest an array of hardcoded values with tooltipsstatic <T,CommandSender>
SafeSuggestions<T, CommandSender> tooltips(Collection<Tooltip<T>> suggestions) Suggest a collection of hardcoded values with tooltipsstatic <T,CommandSender>
SafeSuggestions<T, CommandSender> tooltips(Function<SuggestionInfo<CommandSender>, Tooltip<T>[]> suggestions) Suggest an array of values with tooltips as the result of a functionstatic <T,CommandSender>
SafeSuggestions<T, CommandSender> tooltipsAsync(Function<SuggestionInfo<CommandSender>, CompletableFuture<Tooltip<T>[]>> suggestions) Suggest an array of values with tooltips asynchronouslytoSuggestions(Function<S, String> mapper) Convert thisSafeSuggestionsobject into anArgumentSuggestionsby mapping the values with a string mapping function.
-
Method Details
-
toSuggestions
Convert thisSafeSuggestionsobject into anArgumentSuggestionsby mapping the values with a string mapping function.- Parameters:
mapper- a function which maps an instance ofSafeSuggestionsto a string.- Returns:
- an
ArgumentSuggestionsobject resulting from this mapping.
-
empty
Create an empty SafeSuggestions object.- Type Parameters:
T- type parameter of the SafeSuggestions object- Returns:
- a SafeSuggestions object resulting in empty suggestions
-
suggest
Hardcode an array of values to suggest- Type Parameters:
T- type of the values- Parameters:
suggestions- array of hardcoded values- Returns:
- a SafeSuggestions object suggesting the hardcoded suggestions
-
suggest
Hardcode a collection of values to suggest- Type Parameters:
T- type of the values- Parameters:
suggestions- collection of hardcoded values- Returns:
- a SafeSuggestions object suggesting the hardcoded suggestions
-
suggest
static <T,CommandSender> SafeSuggestions<T,CommandSender> suggest(Function<SuggestionInfo<CommandSender>, T[]> suggestions) Suggest an array of values as the result of a function- Type Parameters:
T- type of the values- Parameters:
suggestions- function providing the array of values- Returns:
- a SafeSuggestion object suggesting the result of the function
-
suggestCollection
static <T,CommandSender> SafeSuggestions<T,CommandSender> suggestCollection(Function<SuggestionInfo<CommandSender>, Collection<T>> suggestions) Suggest a collection of values as the result of a function- Type Parameters:
T- type of the values- Parameters:
suggestions- function providing the collection of values- Returns:
- a SafeSuggestion object suggesting the result of the function
-
suggestAsync
static <T,CommandSender> SafeSuggestions<T,CommandSender> suggestAsync(Function<SuggestionInfo<CommandSender>, CompletableFuture<T[]>> suggestions) Suggest an array of values provided asynchronously- Type Parameters:
T- type of the values- Parameters:
suggestions- function providing the array of values asynchronously- Returns:
- a SafeSuggestion object suggestion the result of the asynchronous function
-
suggestCollectionAsync
static <T,CommandSender> SafeSuggestions<T,CommandSender> suggestCollectionAsync(Function<SuggestionInfo<CommandSender>, CompletableFuture<Collection<T>>> suggestions) Suggest a collection of values provided asynchronously- Type Parameters:
T- type of the values- Parameters:
suggestions- function providing the collection of values asynchronously- Returns:
- a SafeSuggestion object suggestion the result of the asynchronous function
-
tooltips
@SafeVarargs static <T,CommandSender> SafeSuggestions<T,CommandSender> tooltips(Tooltip<T>... suggestions) Suggest an array of hardcoded values with tooltips- Type Parameters:
T- type of the values- Parameters:
suggestions- array of hardcoded values with their tooltips- Returns:
- a SafeSuggestion object suggesting the hardcoded values
-
tooltips
static <T,CommandSender> SafeSuggestions<T,CommandSender> tooltips(Collection<Tooltip<T>> suggestions) Suggest a collection of hardcoded values with tooltips- Type Parameters:
T- type of the values- Parameters:
suggestions- collection of hardcoded values with their tooltips- Returns:
- a SafeSuggestion object suggesting the hardcoded values
-
tooltips
static <T,CommandSender> SafeSuggestions<T,CommandSender> tooltips(Function<SuggestionInfo<CommandSender>, Tooltip<T>[]> suggestions) Suggest an array of values with tooltips as the result of a function- Type Parameters:
T- type of the values- Parameters:
suggestions- function providing the array of values with tooltips- Returns:
- a SafeSuggestion object suggesting the result of the function
-
tooltipCollection
static <T,CommandSender> SafeSuggestions<T,CommandSender> tooltipCollection(Function<SuggestionInfo<CommandSender>, Collection<Tooltip<T>>> suggestions) Suggest a collection of values with tooltips as the result of a function- Type Parameters:
T- type of the values- Parameters:
suggestions- function providing the collection of values with tooltips- Returns:
- a SafeSuggestion object suggesting the result of the function
-
tooltipsAsync
static <T,CommandSender> SafeSuggestions<T,CommandSender> tooltipsAsync(Function<SuggestionInfo<CommandSender>, CompletableFuture<Tooltip<T>[]>> suggestions) Suggest an array of values with tooltips asynchronously- Type Parameters:
T- type of the values- Parameters:
suggestions- function providing the collection of values with tooltips asynchronously- Returns:
- a SafeSuggestion suggesting the result of the asynchronous function
-
tooltipCollectionAsync
static <T,CommandSender> SafeSuggestions<T,CommandSender> tooltipCollectionAsync(Function<SuggestionInfo<CommandSender>, CompletableFuture<Collection<Tooltip<T>>>> suggestions) Suggest a collection of values with tooltips asynchronously- Type Parameters:
T- type of the values- Parameters:
suggestions- function providing the array of values with tooltips asynchronously- Returns:
- a SafeSuggestion suggesting the result of the asynchronous function
-