Interface Previewable<T extends AbstractArgument<?,?,?,?>,A>


public interface Previewable<T extends AbstractArgument<?,?,?,?>,A>
An interface representing that the argument can be previewed using Minecraft's chat preview feature. To use this, the server must have previews-chat=true set in its server.properties file
  • Method Details

    • withPreview

      T withPreview(PreviewableFunction<A> preview)
      Sets the PreviewableFunction for this argument. This function will run when a player requests a chat preview from the server. The function's PreviewInfo will be populated based on the input for the relevant player that requests the chat preview.
      Parameters:
      preview - the function to use for chat preview generation
      Returns:
      the current argument
    • getPreview

      Returns:
      the PreviewableFunction for this argument, as an Optional.
    • usePreview

      T usePreview(boolean usePreview)
      Whether this argument should use the preview result as the argument value for execution. If set to true, accessing this argument in args will return the same value generated from withPreview(PreviewableFunction)
      Parameters:
      usePreview - whether to use the preview as the value for this argument
      Returns:
      the current argument
    • isLegacy

      boolean isLegacy()
      Returns:
      whether this argument uses legacy chat component APIs