Class ContentDisplay<T>

  • Type Parameters:
    T - Type of content to display.

    public class ContentDisplay<T>
    extends java.lang.Object
    Helps to display contents such as list and maps in a nicely formatted fashion.
    • Method Detail

      • forContent

        public static <T> ContentDisplay.Builder<T> forContent​(T content)
        Creates a ContentDisplay.Builder for the given content.
        Type Parameters:
        T - The type of the content which can be inferred.
        Parameters:
        content - The content to be displayed.
        Returns:
        A new Builder.
      • forContent

        public static ContentDisplay.Builder<java.util.Collection<java.lang.String>> forContent​(java.util.Collection<java.lang.String> content)
        Creates a ContentDisplay.Builder for the given collection of content.
        Parameters:
        content - The content to be displayed.
        Returns:
        A new Builder.
      • forContent

        public static ContentDisplay.Builder<java.util.Map<java.lang.String,​java.lang.Object>> forContent​(java.util.Map<java.lang.String,​java.lang.Object> content)
        Creates a ContentDisplay.Builder for the given map of content.
        Parameters:
        content - The content to be displayed.
        Returns:
        A new Builder.
      • show

        public void show​(@NotNull
                         @NotNull org.bukkit.command.CommandSender sender)
        Do the actual displaying of contents to the sender.
        Parameters:
        sender - The CommandSender to show the display to.
      • getHeader

        public java.lang.String getHeader()
        Returns:
        Gets the header to display.
      • setHeader

        public void setHeader​(@NotNull
                              @NotNull java.lang.String header)
        Sets the header text.
      • getContents

        public T getContents()
        Returns:
        Gets the contents to display.
      • getEmptyMessage

        @NotNull
        public @NotNull java.lang.String getEmptyMessage()
        Returns:
        Gets the message to display when no content is shown.
      • getDisplayHandler

        @NotNull
        public @NotNull DisplayHandler<T> getDisplayHandler()
        Returns:
        Gets the display handler that formats and sends content to sender.
      • getColorTool

        @NotNull
        public @NotNull ColorTool getColorTool()
        Returns:
        Gets the color tool used.
      • getFilter

        @NotNull
        public @NotNull ContentFilter getFilter()
        Returns:
        Gets the filter used.
      • getSetting

        public <S> S getSetting​(@NotNull
                                @NotNull DisplaySetting<S> setting)
        Gets the value for a given setting option.
        Type Parameters:
        S - The setting type.
        Parameters:
        setting - The setting option.
        Returns:
        Value set for the given setting.
      • setSetting

        public <S> void setSetting​(@NotNull
                                   @NotNull DisplaySetting<S> setting,
                                   S value)
        Sets other specific settings that may be used by the DisplayHandler.
        Type Parameters:
        S - The type of setting.
        Parameters:
        setting - The settings option.
        value - The value to set.