Class SuggestionResult

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

public class SuggestionResult extends Object
A result from finding all the autocomplete suggestions of an argument
  • Constructor Details

    • SuggestionResult

      public SuggestionResult()
      Creates an unbounded result. Used by the local server console, where JLine needs the complete candidate set to filter correctly as the operator narrows what they have typed.
    • SuggestionResult

      public SuggestionResult(int maxSuggestions)
      Creates a result capped at maxSuggestions. Once the cap is reached, further suggestions are dropped and isTruncated() returns true. Used by the networked client path to bound the suggestion packet.
  • Method Details

    • suggest

      @Nonnull public SuggestionResult suggest(@Nonnull String suggestion)
    • suggestContinuation

      @Nonnull public SuggestionResult suggestContinuation(@Nonnull String suggestion)
    • suggest

      @Nonnull public <DataType> SuggestionResult suggest(@Nonnull Function<DataType,String> toStringFunction, @Nonnull DataType suggestion)
      Suggest an object and provide a toString function to turn it into a String
      Type Parameters:
      DataType - The Type of the suggestion Object
      Parameters:
      toStringFunction - The function to be executed on the object to turn it into a String
      suggestion - The object to suggest
      Returns:
      this, for chaining
    • suggest

      @Nonnull public SuggestionResult suggest(@Nonnull Object objectToString)
      Suggest any random object. The Object.toString() method will be called to convert it to a String
      Parameters:
      objectToString - The object to convert to a String and suggest
      Returns:
      this, for chaining
    • getSuggestions

      @Nonnull public List<String> getSuggestions()
    • getContinuations

      @Nonnull public List<Boolean> getContinuations()
    • markTruncated

      public void markTruncated()
      Marks that more matches existed than were added to this result, i.e. the suggestion list was capped. Lets callers tell the client the result is not the complete set for the query.
    • isTruncated

      public boolean isTruncated()
    • isFull

      public boolean isFull()
      Whether the cap has been reached. Suggesters can check this to stop producing candidates early.