Contents
Class SuggestionUtil
java.lang.Object
com.hypixel.hytale.server.core.command.system.suggestion.SuggestionUtil
Filters candidate values against the text a player has typed so far. Suggestion results sent
to a networked client are capped, so arg types with large candidate sets must filter on the
server: an unfiltered dump fills the cap with the same leading sample on every request, and
values past the cap can never be suggested no matter what the player types.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidsuggestFiltered(Iterable<String> candidates, String textAlreadyEntered, SuggestionResult result) Suggests the candidates matchingtextAlreadyEntered.static voidsuggestFiltered(Iterable<String> candidates, String textAlreadyEntered, UnaryOperator<String> decorate, SuggestionResult result) Variant ofsuggestFiltered(Iterable, String, SuggestionResult)that appliesdecorateto each matched candidate before suggesting it, e.g. to restore a prefix that was stripped from the input for matching.
-
Method Details
-
suggestFiltered
public static void suggestFiltered(@Nonnull Iterable<String> candidates, @Nonnull String textAlreadyEntered, @Nonnull SuggestionResult result) Suggests the candidates matchingtextAlreadyEntered. Prefix matches come first, then substring matches (both case-insensitive, shortest then alphabetical, mirroring the client's local filtering), then fuzzy subsequence matches ranked by score. Substring matches must outrank fuzzy ones: a short input subsequence-matches a large share of any big candidate set at identical scores, which would otherwise crowd the capped result out of the very matches the client's display filter accepts. An empty input suggests the candidates in iteration order. -
suggestFiltered
public static void suggestFiltered(@Nonnull Iterable<String> candidates, @Nonnull String textAlreadyEntered, @Nonnull UnaryOperator<String> decorate, @Nonnull SuggestionResult result) Variant ofsuggestFiltered(Iterable, String, SuggestionResult)that appliesdecorateto each matched candidate before suggesting it, e.g. to restore a prefix that was stripped from the input for matching.
-