public final class Style
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Style.Builder
A style builder.
|
| Modifier and Type | Method and Description |
|---|---|
static @NonNull Style.Builder |
builder()
Creates a builder.
|
@Nullable ClickEvent |
clickEvent()
Gets the click event.
|
@NonNull Style |
clickEvent(@Nullable ClickEvent event)
Sets the click event.
|
@Nullable TextColor |
color()
Gets the color.
|
@NonNull Style |
color(@Nullable TextColor color)
Sets the color.
|
@NonNull Style |
colorIfAbsent(@Nullable TextColor color)
Sets the color if there isn't one set already.
|
TextDecoration.State |
decoration(@NonNull TextDecoration decoration)
Gets the state of a decoration on this style.
|
@NonNull Style |
decoration(@NonNull TextDecoration decoration,
boolean flag)
Sets the state of a decoration on this style.
|
@NonNull Style |
decoration(@NonNull TextDecoration decoration,
TextDecoration.State state)
Sets the value of a decoration on this style.
|
@NonNull java.util.Set<TextDecoration> |
decorations()
Gets a set of decorations this style has.
|
@NonNull java.util.Set<TextDecoration> |
decorations(@NonNull java.util.Set<TextDecoration> defaultValues)
Gets a set of decorations this style has.
|
static @NonNull Style |
empty()
Gets an empty style.
|
boolean |
equals(@Nullable java.lang.Object other) |
boolean |
hasDecoration(@NonNull TextDecoration decoration)
Tests if this style has a decoration.
|
int |
hashCode() |
@Nullable HoverEvent |
hoverEvent()
Gets the hover event.
|
@NonNull Style |
hoverEvent(@Nullable HoverEvent event)
Sets the hover event.
|
@Nullable java.lang.String |
insertion()
Gets the string to be inserted when this style is shift-clicked.
|
@NonNull Style |
insertion(@Nullable java.lang.String insertion)
Sets the string to be inserted when this style is shift-clicked.
|
boolean |
isEmpty()
Tests if this style is empty.
|
@NonNull Style |
mergeColor(@NonNull Style that)
Merges the color from another style into this style.
|
@NonNull Style |
mergeDecorations(@NonNull Style that)
Merges the decorations from another style into this style.
|
@NonNull Style |
mergeEvents(@NonNull Style that)
Merges the events from another style into this style.
|
static @NonNull Style |
of(@Nullable TextColor color)
Creates a style with color.
|
static @NonNull Style |
of(@Nullable TextColor color,
TextDecoration... decorations)
Creates a style with color and decorations.
|
@NonNull Style.Builder |
toBuilder()
Create a builder from this style.
|
@NonNull java.lang.String |
toString() |
public static @NonNull Style.Builder builder()
public static @NonNull Style empty()
public static @NonNull Style of(@Nullable TextColor color)
color - the stylepublic static @NonNull Style of(@Nullable TextColor color, TextDecoration... decorations)
color - the styledecorations - the decorationspublic @Nullable TextColor color()
public @NonNull Style colorIfAbsent(@Nullable TextColor color)
color - the colorpublic @NonNull Style color(@Nullable TextColor color)
color - the colorpublic boolean hasDecoration(@NonNull TextDecoration decoration)
decoration - the decorationtrue if this style has the decoration, false if this
style does not have the decorationpublic TextDecoration.State decoration(@NonNull TextDecoration decoration)
decoration - the decorationTextDecoration.State.TRUE if this style has the decoration,
TextDecoration.State.FALSE if this style does not have the decoration,
and TextDecoration.State.NOT_SET if not setpublic @NonNull Style decoration(@NonNull TextDecoration decoration, boolean flag)
decoration - the decorationflag - true if this style should have the decoration, false if
this style should not have the decorationpublic @NonNull Style decoration(@NonNull TextDecoration decoration, TextDecoration.State state)
decoration - the decorationstate - TextDecoration.State.TRUE if this style should have the
decoration, TextDecoration.State.FALSE if this style should not
have the decoration, and TextDecoration.State.NOT_SET if the decoration
should not have a set valuepublic @NonNull java.util.Set<TextDecoration> decorations()
public @NonNull java.util.Set<TextDecoration> decorations(@NonNull java.util.Set<TextDecoration> defaultValues)
defaultValues - a set of default valuespublic @Nullable ClickEvent clickEvent()
public @NonNull Style clickEvent(@Nullable ClickEvent event)
event - the click eventpublic @Nullable HoverEvent hoverEvent()
public @NonNull Style hoverEvent(@Nullable HoverEvent event)
event - the hover eventpublic @Nullable java.lang.String insertion()
public @NonNull Style insertion(@Nullable java.lang.String insertion)
insertion - the insertion stringpublic @NonNull Style mergeColor(@NonNull Style that)
that - the other stylepublic @NonNull Style mergeDecorations(@NonNull Style that)
that - the other stylepublic @NonNull Style mergeEvents(@NonNull Style that)
that - the other stylepublic boolean isEmpty()
true if this style is empty, false if this
style is not emptypublic @NonNull Style.Builder toBuilder()
public @NonNull java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(@Nullable java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object