Class ChatPaginator


  • public class ChatPaginator
    extends Object
    The ChatPaginator takes a raw string of arbitrary length and breaks it down into an array of strings appropriate for displaying on the Minecraft player console.
    • Constructor Detail

      • ChatPaginator

        public ChatPaginator()
    • Method Detail

      • paginate

        @NotNull
        public static ChatPaginator.ChatPage paginate​(@Nullable
                                                      String unpaginatedString,
                                                      int pageNumber)
        Breaks a raw string up into pages using the default width and height.
        Parameters:
        unpaginatedString - The raw string to break.
        pageNumber - The page number to fetch.
        Returns:
        A single chat page.
      • paginate

        @NotNull
        public static ChatPaginator.ChatPage paginate​(@Nullable
                                                      String unpaginatedString,
                                                      int pageNumber,
                                                      int lineLength,
                                                      int pageHeight)
        Breaks a raw string up into pages using a provided width and height.
        Parameters:
        unpaginatedString - The raw string to break.
        pageNumber - The page number to fetch.
        lineLength - The desired width of a chat line.
        pageHeight - The desired number of lines in a page.
        Returns:
        A single chat page.
      • wordWrap

        @NotNull
        public static String[] wordWrap​(@Nullable
                                        String rawString,
                                        int lineLength)
        Breaks a raw string up into a series of lines. Words are wrapped using spaces as decimeters and the newline character is respected.
        Parameters:
        rawString - The raw string to break.
        lineLength - The length of a line of text.
        Returns:
        An array of word-wrapped lines.