Class SuggestionUtil

java.lang.Object
com.hypixel.hytale.server.core.command.system.suggestion.SuggestionUtil

public final class SuggestionUtil extends Object
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 Details

    • suggestFiltered

      public static void suggestFiltered(@Nonnull Iterable<String> candidates, @Nonnull String textAlreadyEntered, @Nonnull SuggestionResult result)
      Suggests the candidates matching textAlreadyEntered. 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 of suggestFiltered(Iterable, String, SuggestionResult) that applies decorate to each matched candidate before suggesting it, e.g. to restore a prefix that was stripped from the input for matching.