Class ContentDisplay<T>
- java.lang.Object
-
- com.onarandombox.MultiverseCore.display.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ContentDisplay.Builder<T>
Builds aContentDisplay
.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
LINE_BREAK
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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.static <T> ContentDisplay.Builder<T>
forContent(T content)
Creates a ContentDisplay.Builder for the given content.@NotNull ColorTool
getColorTool()
T
getContents()
@NotNull DisplayHandler<T>
getDisplayHandler()
@NotNull java.lang.String
getEmptyMessage()
@NotNull ContentFilter
getFilter()
java.lang.String
getHeader()
<S> S
getSetting(@NotNull DisplaySetting<S> setting)
Gets the value for a given setting option.void
setHeader(@NotNull java.lang.String header)
Sets the header text.<S> void
setSetting(@NotNull DisplaySetting<S> setting, S value)
Sets other specific settings that may be used by theDisplayHandler
.void
show(@NotNull org.bukkit.command.CommandSender sender)
Do the actual displaying of contents to the sender.
-
-
-
Field Detail
-
LINE_BREAK
public static final java.lang.String LINE_BREAK
- See Also:
- Constant Field Values
-
-
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 theDisplayHandler
.- Type Parameters:
S
- The type of setting.- Parameters:
setting
- The settings option.value
- The value to set.
-
-