org.bukkit.util
Class ChatPaginator

java.lang.Object
  extended by org.bukkit.util.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.


Nested Class Summary
static class ChatPaginator.ChatPage
           
 
Field Summary
static int AVERAGE_CHAT_PAGE_WIDTH
           
static int CLOSED_CHAT_PAGE_HEIGHT
           
static int GUARANTEED_NO_WRAP_CHAT_PAGE_WIDTH
           
static int OPEN_CHAT_PAGE_HEIGHT
           
static int UNBOUNDED_PAGE_HEIGHT
           
static int UNBOUNDED_PAGE_WIDTH
           
 
Constructor Summary
ChatPaginator()
           
 
Method Summary
static ChatPaginator.ChatPage paginate(String unpaginatedString, int pageNumber)
          Breaks a raw string up into pages using the default width and height.
static ChatPaginator.ChatPage paginate(String unpaginatedString, int pageNumber, int lineLength, int pageHeight)
          Breaks a raw string up into pages using a provided width and height.
static String[] wordWrap(String rawString, int lineLength)
          Breaks a raw string up into a series of lines.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GUARANTEED_NO_WRAP_CHAT_PAGE_WIDTH

public static final int GUARANTEED_NO_WRAP_CHAT_PAGE_WIDTH
See Also:
Constant Field Values

AVERAGE_CHAT_PAGE_WIDTH

public static final int AVERAGE_CHAT_PAGE_WIDTH
See Also:
Constant Field Values

UNBOUNDED_PAGE_WIDTH

public static final int UNBOUNDED_PAGE_WIDTH
See Also:
Constant Field Values

OPEN_CHAT_PAGE_HEIGHT

public static final int OPEN_CHAT_PAGE_HEIGHT
See Also:
Constant Field Values

CLOSED_CHAT_PAGE_HEIGHT

public static final int CLOSED_CHAT_PAGE_HEIGHT
See Also:
Constant Field Values

UNBOUNDED_PAGE_HEIGHT

public static final int UNBOUNDED_PAGE_HEIGHT
See Also:
Constant Field Values
Constructor Detail

ChatPaginator

public ChatPaginator()
Method Detail

paginate

public static ChatPaginator.ChatPage paginate(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

public static ChatPaginator.ChatPage paginate(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

public static String[] wordWrap(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.


Copyright © 2013. All Rights Reserved.