public interface Component
| Modifier and Type | Field and Description |
|---|---|
static java.util.List<Component> |
EMPTY_COMPONENT_LIST
An empty, unmodifiable, list of components.
|
| Modifier and Type | Method and Description |
|---|---|
@NonNull Component |
append(@NonNull Component component)
Appends a component to this component.
|
@NonNull java.util.List<Component> |
children()
Gets the unmodifiable list of children.
|
@Nullable ClickEvent |
clickEvent()
Gets the click event of this component.
|
@NonNull Component |
clickEvent(@Nullable ClickEvent event)
Sets the click event of this component.
|
@Nullable TextColor |
color()
Gets the color of this component.
|
@NonNull Component |
color(@Nullable TextColor color)
Sets the color of this component.
|
default boolean |
contains(@NonNull Component that)
Checks if this component contains a component.
|
@NonNull Component |
copy()
Creates a component.
|
TextDecoration.State |
decoration(@NonNull TextDecoration decoration)
Gets the state of a decoration on this component.
|
default @NonNull Component |
decoration(@NonNull TextDecoration decoration,
boolean flag)
Sets the state of a decoration on this component.
|
@NonNull Component |
decoration(@NonNull TextDecoration decoration,
TextDecoration.State state)
Sets the value of a decoration on this component.
|
default @NonNull java.util.Set<TextDecoration> |
decorations()
Gets a set of decorations this component has.
|
default @NonNull java.util.Set<TextDecoration> |
decorations(@NonNull java.util.Set<TextDecoration> defaultValues)
Gets a set of decorations this component has.
|
default void |
detectCycle(@NonNull Component that)
Prevents a cycle between this component and the provided component.
|
default boolean |
hasDecoration(@NonNull TextDecoration decoration)
Tests if this component has a decoration.
|
boolean |
hasStyling()
Tests if this component has any styling.
|
@Nullable HoverEvent |
hoverEvent()
Gets the hover event of this component.
|
@NonNull Component |
hoverEvent(@Nullable HoverEvent event)
Sets the hover event of this component.
|
@Nullable java.lang.String |
insertion()
Gets the string to be inserted when this component is shift-clicked.
|
@NonNull Component |
insertion(@Nullable java.lang.String insertion)
Sets the string to be inserted when this component is shift-clicked.
|
@NonNull Component |
mergeColor(@NonNull Component that)
Merges the color from another component into this component.
|
@NonNull Component |
mergeDecorations(@NonNull Component that)
Merges the decorations from another component into this component.
|
@NonNull Component |
mergeEvents(@NonNull Component that)
Merges the events from another component into this component.
|
@NonNull Component |
mergeStyle(@NonNull Component that)
Merges styling from another component into this component.
|
static @NonNull Component |
of(boolean value)
Creates a text component with the content of
String.valueOf(boolean). |
static @NonNull Component |
of(char value)
Creates a text component with the content of
String.valueOf(char). |
static @NonNull Component |
of(double value)
Creates a text component with the content of
String.valueOf(double). |
static @NonNull Component |
of(float value)
Creates a text component with the content of
String.valueOf(float). |
static @NonNull Component |
of(int value)
Creates a text component with the content of
String.valueOf(int). |
static @NonNull Component |
of(long value)
Creates a text component with the content of
String.valueOf(long). |
@NonNull Component |
resetStyle()
Resets all styling on this component.
|
static final java.util.List<Component> EMPTY_COMPONENT_LIST
@NonNull java.util.List<Component> children()
default boolean contains(@NonNull Component that)
that - the other componenttrue if this component contains the provided
component, false otherwisedefault void detectCycle(@NonNull Component that)
that - the other component@NonNull Component append(@NonNull Component component)
component - the component to append@NonNull Component copy()
@Nullable TextColor color()
@NonNull Component color(@Nullable TextColor color)
color - the colordefault boolean hasDecoration(@NonNull TextDecoration decoration)
decoration - the decorationtrue if this component has the decoration, false if this
component does not have the decorationTextDecoration.State decoration(@NonNull TextDecoration decoration)
decoration - the decorationTextDecoration.State#TRUE if this component has the decoration,
TextDecoration.State#FALSE if this component does not have the decoration,
and TextDecoration.State#NOT_SET if not setdefault @NonNull Component decoration(@NonNull TextDecoration decoration, boolean flag)
decoration - the decorationflag - true if this component should have the decoration, false if
this component should not have the decoration@NonNull Component decoration(@NonNull TextDecoration decoration, TextDecoration.State state)
decoration - the decorationstate - TextDecoration.State#TRUE if this component should have the
decoration, TextDecoration.State#FALSE if this component should not
have the decoration, and TextDecoration.State#NOT_SET if the decoration
should not have a set valuedefault @NonNull java.util.Set<TextDecoration> decorations()
default @NonNull java.util.Set<TextDecoration> decorations(@NonNull java.util.Set<TextDecoration> defaultValues)
defaultValues - a set of default values@Nullable ClickEvent clickEvent()
@NonNull Component clickEvent(@Nullable ClickEvent event)
event - the click event@Nullable HoverEvent hoverEvent()
@NonNull Component hoverEvent(@Nullable HoverEvent event)
event - the hover event@Nullable java.lang.String insertion()
@NonNull Component insertion(@Nullable java.lang.String insertion)
insertion - the insertion string@NonNull Component mergeStyle(@NonNull Component that)
that - the other component@NonNull Component mergeColor(@NonNull Component that)
that - the other component@NonNull Component mergeDecorations(@NonNull Component that)
that - the other component@NonNull Component mergeEvents(@NonNull Component that)
that - the other component@NonNull Component resetStyle()
boolean hasStyling()
true if this component has any styling, false if this
component does not have any stylingstatic @NonNull Component of(boolean value)
String.valueOf(boolean).value - the boolean valuestatic @NonNull Component of(char value)
String.valueOf(char).value - the char valuestatic @NonNull Component of(double value)
String.valueOf(double).value - the double valuestatic @NonNull Component of(float value)
String.valueOf(float).value - the float valuestatic @NonNull Component of(int value)
String.valueOf(int).value - the int valuestatic @NonNull Component of(long value)
String.valueOf(long).value - the long value