Package net.kyori.adventure.text.format
Interface Style
- All Superinterfaces:
Buildable<Style,Style.Builder>,net.kyori.examination.Examinable
public interface Style extends Buildable<Style,Style.Builder>, net.kyori.examination.Examinable
A style.
- Since:
- 4.0.0
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceStyle.BuilderA style builder.static classStyle.MergeA merge choice. -
Field Summary
Fields Modifier and Type Field Description static KeyDEFAULT_FONTThe default font. -
Method Summary
Modifier and Type Method Description @Nullable ClickEventclickEvent()Gets the click event.@NonNull StyleclickEvent(@Nullable ClickEvent event)Sets the click event.@Nullable TextColorcolor()Gets the color.@NonNull Stylecolor(@Nullable TextColor color)Sets the color.@NonNull StylecolorIfAbsent(@Nullable TextColor color)Sets the color if there isn't one set already.default @NonNull Styledecorate(@NonNull TextDecoration decoration)Sets the state ofdecorationtoTextDecoration.State.TRUEon this style.@NonNull TextDecoration.Statedecoration(@NonNull TextDecoration decoration)Gets the state of a decoration on this style.default @NonNull Styledecoration(@NonNull TextDecoration decoration, boolean flag)Sets the state of a decoration on this style.@NonNull Styledecoration(@NonNull TextDecoration decoration, @NonNull TextDecoration.State state)Sets the value of a decoration on this style.@NonNull Map<TextDecoration,TextDecoration.State>decorations()Gets a map of decorations this style has.@NonNull Styledecorations(@NonNull Map<TextDecoration,TextDecoration.State> decorations)Sets decorations for this style using the specifieddecorationsmap.default @NonNull Styleedit(@NonNull Consumer<Style.Builder> consumer)Edits this style.default @NonNull Styleedit(@NonNull Consumer<Style.Builder> consumer, @NonNull Style.Merge.Strategy strategy)Edits this style.static @NonNull Styleempty()Gets an empty style.@Nullable Keyfont()Gets the font.@NonNull Stylefont(@Nullable Key font)Sets the font.default booleanhasDecoration(@NonNull TextDecoration decoration)Tests if this style has a decoration.@Nullable HoverEvent<?>hoverEvent()Gets the hover event.@NonNull StylehoverEvent(@Nullable HoverEventSource<?> source)Sets the hover event.@Nullable Stringinsertion()Gets the string to be inserted when this style is shift-clicked.@NonNull Styleinsertion(@Nullable String insertion)Sets the string to be inserted when this style is shift-clicked.booleanisEmpty()Tests if this style is empty.default @NonNull Stylemerge(@NonNull Style that)Merges from another style into this style.default @NonNull Stylemerge(@NonNull Style that, @NonNull Set<Style.Merge> merges)Merges from another style into this style.default @NonNull Stylemerge(@NonNull Style that, @NonNull Style.Merge merge)Merges from another style into this style.default @NonNull Stylemerge(@NonNull Style that, @NonNull Style.Merge.Strategy strategy)Merges from another style into this style.@NonNull Stylemerge(@NonNull Style that, @NonNull Style.Merge.Strategy strategy, @NonNull Set<Style.Merge> merges)Merges from another style into this style.default @NonNull Stylemerge(@NonNull Style that, @NonNull Style.Merge.Strategy strategy, @NonNull Style.Merge merge)Merges from another style into this style.default @NonNull Stylemerge(@NonNull Style that, @NonNull Style.Merge.Strategy strategy, @NonNull Style.Merge @NonNull ... merges)Merges from another style into this style.default @NonNull Stylemerge(@NonNull Style that, @NonNull Style.Merge @NonNull ... merges)Merges from another style into this style.static @NonNull Style.Builderstyle()Creates a builder.static @NonNull Stylestyle(@NonNull Iterable<? extends StyleBuilderApplicable> applicables)Creates a style withapplicablesapplied.static @NonNull Stylestyle(@NonNull Consumer<Style.Builder> consumer)Creates a style.static @NonNull Stylestyle(@NonNull TextDecoration decoration)Creates a style with decoration.static @NonNull Stylestyle(@Nullable TextColor color)Creates a style with color.static @NonNull Stylestyle(@Nullable TextColor color, Set<TextDecoration> decorations)Creates a style with color and decorations.static @NonNull Stylestyle(@Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a style with color and decorations.static @NonNull Stylestyle(StyleBuilderApplicable @NonNull ... applicables)Creates a style withapplicablesapplied.@NonNull Style.BuildertoBuilder()Create a builder from this style.
-
Field Details
-
DEFAULT_FONT
The default font.- Since:
- 4.0.0
-
-
Method Details
-
empty
Gets an empty style.- Returns:
- empty style
- Since:
- 4.0.0
-
style
Creates a builder.- Returns:
- a builder
- Since:
- 4.0.0
-
style
Creates a style.- Parameters:
consumer- the builder consumer- Returns:
- a style
- Since:
- 4.0.0
-
style
Creates a style with color.- Parameters:
color- the style- Returns:
- a style
- Since:
- 4.0.0
-
style
Creates a style with decoration.- Parameters:
decoration- the decoration- Returns:
- a style
- Since:
- 4.0.0
-
style
Creates a style with color and decorations.- Parameters:
color- the styledecorations- the decorations- Returns:
- a style
- Since:
- 4.0.0
-
style
Creates a style with color and decorations.- Parameters:
color- the styledecorations- the decorations- Returns:
- a style
- Since:
- 4.0.0
-
style
Creates a style withapplicablesapplied.- Parameters:
applicables- the applicables- Returns:
- a style
- Since:
- 4.0.0
-
style
Creates a style withapplicablesapplied.- Parameters:
applicables- the applicables- Returns:
- a style
- Since:
- 4.0.0
-
edit
Edits this style.The old style will be merge into the new style before
consumeris called.- Parameters:
consumer- the consumer- Returns:
- a new style
- Since:
- 4.0.0
-
edit
default @NonNull Style edit(@NonNull Consumer<Style.Builder> consumer, @NonNull Style.Merge.Strategy strategy)Edits this style.- Parameters:
consumer- the consumerstrategy- the merge strategy- Returns:
- a new style
- Since:
- 4.0.0
-
font
@Nullable Key font()Gets the font.- Returns:
- the font
- Since:
- 4.0.0
-
font
Sets the font.- Parameters:
font- the font- Returns:
- a style
- Since:
- 4.0.0
-
color
@Nullable TextColor color()Gets the color.- Returns:
- the color
- Since:
- 4.0.0
-
color
Sets the color.- Parameters:
color- the color- Returns:
- a style
- Since:
- 4.0.0
-
colorIfAbsent
Sets the color if there isn't one set already.- Parameters:
color- the color- Returns:
- this builder
- Since:
- 4.0.0
-
hasDecoration
Tests if this style has a decoration.- Parameters:
decoration- the decoration- Returns:
trueif this style has the decoration,falseif this style does not have the decoration- Since:
- 4.0.0
-
decoration
Gets the state of a decoration on this style.- Parameters:
decoration- the decoration- Returns:
TextDecoration.State.TRUEif this style has the decoration,TextDecoration.State.FALSEif this style does not have the decoration, andTextDecoration.State.NOT_SETif not set- Since:
- 4.0.0
-
decorate
Sets the state ofdecorationtoTextDecoration.State.TRUEon this style.- Parameters:
decoration- the decoration- Returns:
- a style
- Since:
- 4.0.0
-
decoration
Sets the state of a decoration on this style.- Parameters:
decoration- the decorationflag-trueif this style should have the decoration,falseif this style should not have the decoration- Returns:
- a style
- Since:
- 4.0.0
-
decoration
Sets the value of a decoration on this style.- Parameters:
decoration- the decorationstate-TextDecoration.State.TRUEif this style should have the decoration,TextDecoration.State.FALSEif this style should not have the decoration, andTextDecoration.State.NOT_SETif the decoration should not have a set value- Returns:
- a style
- Since:
- 4.0.0
-
decorations
@NonNull Map<TextDecoration,TextDecoration.State> decorations()Gets a map of decorations this style has.- Returns:
- a set of decorations this style has
- Since:
- 4.0.0
-
decorations
Sets decorations for this style using the specifieddecorationsmap.If a given decoration does not have a value explicitly set, the value of that particular decoration is not changed.
- Parameters:
decorations- the decorations- Returns:
- a style
- Since:
- 4.0.0
-
clickEvent
@Nullable ClickEvent clickEvent()Gets the click event.- Returns:
- the click event
- Since:
- 4.0.0
-
clickEvent
Sets the click event.- Parameters:
event- the click event- Returns:
- a style
- Since:
- 4.0.0
-
hoverEvent
@Nullable HoverEvent<?> hoverEvent()Gets the hover event.- Returns:
- the hover event
- Since:
- 4.0.0
-
hoverEvent
Sets the hover event.- Parameters:
source- the hover event source- Returns:
- a style
- Since:
- 4.0.0
-
insertion
@Nullable String insertion()Gets the string to be inserted when this style is shift-clicked.- Returns:
- the insertion string
- Since:
- 4.0.0
-
insertion
Sets the string to be inserted when this style is shift-clicked.- Parameters:
insertion- the insertion string- Returns:
- a style
- Since:
- 4.0.0
-
merge
Merges from another style into this style.- Parameters:
that- the other style- Returns:
- a style
- Since:
- 4.0.0
-
merge
Merges from another style into this style.- Parameters:
that- the other stylestrategy- the merge strategy- Returns:
- a style
- Since:
- 4.0.0
-
merge
Merges from another style into this style.- Parameters:
that- the other stylemerge- the part to merge- Returns:
- a style
- Since:
- 4.0.0
-
merge
default @NonNull Style merge(@NonNull Style that, @NonNull Style.Merge.Strategy strategy, @NonNull Style.Merge merge)Merges from another style into this style.- Parameters:
that- the other stylestrategy- the merge strategymerge- the part to merge- Returns:
- a style
- Since:
- 4.0.0
-
merge
Merges from another style into this style.- Parameters:
that- the other stylemerges- the parts to merge- Returns:
- a style
- Since:
- 4.0.0
-
merge
default @NonNull Style merge(@NonNull Style that, @NonNull Style.Merge.Strategy strategy, @NonNull Style.Merge @NonNull ... merges)Merges from another style into this style.- Parameters:
that- the other stylestrategy- the merge strategymerges- the parts to merge- Returns:
- a style
- Since:
- 4.0.0
-
merge
Merges from another style into this style.- Parameters:
that- the other stylemerges- the parts to merge- Returns:
- a style
- Since:
- 4.0.0
-
merge
@NonNull Style merge(@NonNull Style that, @NonNull Style.Merge.Strategy strategy, @NonNull Set<Style.Merge> merges)Merges from another style into this style.- Parameters:
that- the other stylestrategy- the merge strategymerges- the parts to merge- Returns:
- a style
- Since:
- 4.0.0
-
isEmpty
boolean isEmpty()Tests if this style is empty.- Returns:
trueif this style is empty,falseif this style is not empty- Since:
- 4.0.0
-
toBuilder
@NonNull Style.Builder toBuilder()Create a builder from this style.- Specified by:
toBuilderin interfaceBuildable<Style,Style.Builder>- Returns:
- a builder
-