Package net.kyori.adventure.text.format
Interface Style.Builder
- All Superinterfaces:
AbstractBuilder<Style>
,Buildable.Builder<Style>
,MutableStyleSetter<Style.Builder>
,StyleSetter<Style.Builder>
- Enclosing interface:
- Style
public static interface Style.Builder
extends AbstractBuilder<Style>, Buildable.Builder<Style>, MutableStyleSetter<Style.Builder>
A style builder.
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault @NotNull Style.Builder
apply
(@NotNull StyleBuilderApplicable applicable) Appliesapplicable
to this builder.@NotNull Style
build()
Builds the style.@NotNull Style.Builder
clickEvent
(@Nullable ClickEvent event) Sets the click event.@NotNull Style.Builder
Sets the color.@NotNull Style.Builder
colorIfAbsent
(@Nullable TextColor color) Sets the color if there isn't one set already.default @NotNull Style.Builder
decorate
(@NotNull TextDecoration decoration) Setsdecoration
toTextDecoration.State.TRUE
.default @NotNull Style.Builder
decorate
(@NotNull TextDecoration @NotNull ... decorations) Setsdecorations
toTextDecoration.State.TRUE
.default @NotNull Style.Builder
decoration
(@NotNull TextDecoration decoration, boolean flag) Sets the state of a decoration on this style.@NotNull Style.Builder
decoration
(@NotNull TextDecoration decoration, @NotNull TextDecoration.State state) Sets the value of a decoration.@NotNull Style.Builder
decorationIfAbsent
(@NotNull TextDecoration decoration, @NotNull TextDecoration.State state) Sets the state of a decoration on this style tostate
if the current state of the decoration isTextDecoration.State.NOT_SET
.default @NotNull Style.Builder
decorations
(@NotNull Map<TextDecoration, TextDecoration.State> decorations) Sets decorations for this style using the specifieddecorations
map.@NotNull Style.Builder
Sets the font.@NotNull Style.Builder
hoverEvent
(@Nullable HoverEventSource<?> source) Sets the hover event.@NotNull Style.Builder
Sets the string to be inserted.default @NotNull Style.Builder
Merges from another style into this style.default @NotNull Style.Builder
merge
(@NotNull Style that, @NotNull Set<Style.Merge> merges) Merges from another style into this style.default @NotNull Style.Builder
merge
(@NotNull Style that, @NotNull Style.Merge.Strategy strategy) Merges from another style into this style.@NotNull Style.Builder
merge
(@NotNull Style that, @NotNull Style.Merge.Strategy strategy, @NotNull Set<Style.Merge> merges) Merges from another style into this style.default @NotNull Style.Builder
merge
(@NotNull Style that, @NotNull Style.Merge.Strategy strategy, @NotNull Style.Merge @NotNull ... merges) Merges from another style into this style.default @NotNull Style.Builder
merge
(@NotNull Style that, @NotNull Style.Merge @NotNull ... merges) Merges from another style into this style.Methods inherited from interface net.kyori.adventure.text.format.MutableStyleSetter
decorations
Methods inherited from interface net.kyori.adventure.text.format.StyleSetter
shadowColor, shadowColorIfAbsent
-
Method Details
-
font
Sets the font.- Specified by:
font
in interfaceStyleSetter<Style.Builder>
- Parameters:
font
- the font- Returns:
- this builder
- Since:
- 4.0.0
- Since Minecraft:
- 1.16
-
color
Sets the color.- Specified by:
color
in interfaceStyleSetter<Style.Builder>
- Parameters:
color
- the color- Returns:
- this builder
- Since:
- 4.0.0
-
colorIfAbsent
@Contract("_ -> this") @NotNull @NotNull Style.Builder colorIfAbsent(@Nullable @Nullable TextColor color) Sets the color if there isn't one set already.- Specified by:
colorIfAbsent
in interfaceStyleSetter<Style.Builder>
- Parameters:
color
- the color- Returns:
- this builder
- Since:
- 4.0.0
-
decorate
@Contract("_ -> this") @NotNull default @NotNull Style.Builder decorate(@NotNull @NotNull TextDecoration decoration) Setsdecoration
toTextDecoration.State.TRUE
.- Specified by:
decorate
in interfaceStyleSetter<Style.Builder>
- Parameters:
decoration
- the decoration- Returns:
- a style
- Since:
- 4.0.0
-
decorate
@Contract("_ -> this") @NotNull default @NotNull Style.Builder decorate(@NotNull @NotNull TextDecoration @NotNull ... decorations) Setsdecorations
toTextDecoration.State.TRUE
.- Specified by:
decorate
in interfaceMutableStyleSetter<Style.Builder>
- Specified by:
decorate
in interfaceStyleSetter<Style.Builder>
- Parameters:
decorations
- the decorations- Returns:
- a style
- Since:
- 4.0.0
-
decoration
@Contract("_, _ -> this") @NotNull default @NotNull Style.Builder decoration(@NotNull @NotNull TextDecoration decoration, boolean flag) Sets the state of a decoration on this style.- Specified by:
decoration
in interfaceStyleSetter<Style.Builder>
- Parameters:
decoration
- the decorationflag
-true
if this style should have the decoration,false
if this style should not have the decoration- Returns:
- a style
- Since:
- 4.0.0
-
decorations
@Contract("_ -> this") @NotNull default @NotNull Style.Builder decorations(@NotNull @NotNull Map<TextDecoration, TextDecoration.State> decorations) Sets decorations for this style using the specifieddecorations
map.If a given decoration does not have a value explicitly set, the value of that particular decoration is not changed.
- Specified by:
decorations
in interfaceMutableStyleSetter<Style.Builder>
- Specified by:
decorations
in interfaceStyleSetter<Style.Builder>
- Parameters:
decorations
- a map containing text decorations and their respective state.- Returns:
- this builder.
- Since:
- 4.10.0
-
decoration
@Contract("_, _ -> this") @NotNull @NotNull Style.Builder decoration(@NotNull @NotNull TextDecoration decoration, @NotNull TextDecoration.State state) Sets the value of a decoration.- Specified by:
decoration
in interfaceStyleSetter<Style.Builder>
- Parameters:
decoration
- the decorationstate
-TextDecoration.State.TRUE
if this component should have the decoration,TextDecoration.State.FALSE
if this component should not have the decoration, andTextDecoration.State.NOT_SET
if the decoration should not have a set value- Returns:
- this builder
- Since:
- 4.0.0
-
decorationIfAbsent
@Contract("_, _ -> this") @NotNull @NotNull Style.Builder decorationIfAbsent(@NotNull @NotNull TextDecoration decoration, @NotNull TextDecoration.State state) Sets the state of a decoration on this style tostate
if the current state of the decoration isTextDecoration.State.NOT_SET
.- Specified by:
decorationIfAbsent
in interfaceStyleSetter<Style.Builder>
- Parameters:
decoration
- the decorationstate
- the state- Returns:
- this builder
- Since:
- 4.12.0
-
clickEvent
@Contract("_ -> this") @NotNull @NotNull Style.Builder clickEvent(@Nullable @Nullable ClickEvent event) Sets the click event.- Specified by:
clickEvent
in interfaceStyleSetter<Style.Builder>
- Parameters:
event
- the click event- Returns:
- this builder
- Since:
- 4.0.0
-
hoverEvent
@Contract("_ -> this") @NotNull @NotNull Style.Builder hoverEvent(@Nullable @Nullable HoverEventSource<?> source) Sets the hover event.- Specified by:
hoverEvent
in interfaceStyleSetter<Style.Builder>
- Parameters:
source
- the hover event source- Returns:
- this builder
- Since:
- 4.0.0
-
insertion
@Contract("_ -> this") @NotNull @NotNull Style.Builder insertion(@Nullable @Nullable String insertion) Sets the string to be inserted.- Specified by:
insertion
in interfaceStyleSetter<Style.Builder>
- Parameters:
insertion
- the insertion string- Returns:
- this builder
- Since:
- 4.0.0
-
merge
Merges from another style into this style.- Parameters:
that
- the other style- Returns:
- this builder
- Since:
- 4.0.0
-
merge
@Contract("_, _ -> this") @NotNull default @NotNull Style.Builder merge(@NotNull @NotNull Style that, @NotNull Style.Merge.Strategy strategy) Merges from another style into this style.- Parameters:
that
- the other stylestrategy
- the merge strategy- Returns:
- this builder
- Since:
- 4.0.0
-
merge
@Contract("_, _ -> this") @NotNull default @NotNull Style.Builder merge(@NotNull @NotNull Style that, @NotNull @NotNull Style.Merge @NotNull ... merges) Merges from another style into this style.- Parameters:
that
- the other stylemerges
- the parts to merge- Returns:
- this builder
- Since:
- 4.0.0
-
merge
@Contract("_, _, _ -> this") @NotNull default @NotNull Style.Builder merge(@NotNull @NotNull Style that, @NotNull Style.Merge.Strategy strategy, @NotNull @NotNull Style.Merge @NotNull ... merges) Merges from another style into this style.- Parameters:
that
- the other stylestrategy
- the merge strategymerges
- the parts to merge- Returns:
- this builder
- Since:
- 4.0.0
-
merge
@Contract("_, _ -> this") @NotNull default @NotNull Style.Builder merge(@NotNull @NotNull Style that, @NotNull @NotNull Set<Style.Merge> merges) Merges from another style into this style.- Parameters:
that
- the other stylemerges
- the parts to merge- Returns:
- this builder
- Since:
- 4.0.0
-
merge
@Contract("_, _, _ -> this") @NotNull @NotNull Style.Builder merge(@NotNull @NotNull Style that, @NotNull Style.Merge.Strategy strategy, @NotNull @NotNull Set<Style.Merge> merges) Merges from another style into this style.- Parameters:
that
- the other stylestrategy
- the merge strategymerges
- the parts to merge- Returns:
- this builder
- Since:
- 4.0.0
-
apply
@Contract("_ -> this") @NotNull default @NotNull Style.Builder apply(@NotNull @NotNull StyleBuilderApplicable applicable) Appliesapplicable
to this builder.- Parameters:
applicable
- the applicable- Returns:
- this builder
- Since:
- 4.0.0
-
build
Builds the style.- Specified by:
build
in interfaceAbstractBuilder<Style>
- Specified by:
build
in interfaceBuildable.Builder<Style>
- Returns:
- the style
-