Package net.kyori.adventure.text.format
Interface StyleSetter<T extends StyleSetter<?>>
-
- Type Parameters:
T
- the type implementing this interface, e.g.Component
- All Known Subinterfaces:
BlockNBTComponent
,BlockNBTComponent.Builder
,BuildableComponent<C,B>
,Component
,ComponentBuilder<C,B>
,EntityNBTComponent
,EntityNBTComponent.Builder
,KeybindComponent
,KeybindComponent.Builder
,MutableStyleSetter<T>
,NBTComponent<C,B>
,NBTComponentBuilder<C,B>
,ScopedComponent<C>
,ScoreComponent
,ScoreComponent.Builder
,SelectorComponent
,SelectorComponent.Builder
,StorageNBTComponent
,StorageNBTComponent.Builder
,Style
,Style.Builder
,TextComponent
,TextComponent.Builder
,TranslatableComponent
,TranslatableComponent.Builder
- All Known Implementing Classes:
AbstractComponent
@NonExtendable public interface StyleSetter<T extends StyleSetter<?>>
Writes style properties to an object.- Since:
- 4.10.0
- See Also:
Style
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description T
clickEvent(@Nullable ClickEvent event)
Sets the click event.T
color(@Nullable TextColor color)
Sets the color.T
colorIfAbsent(@Nullable TextColor color)
Sets the color if there isn't one set already.default T
decorate(@NotNull TextDecoration decoration)
Sets the state ofdecoration
toTextDecoration.State.TRUE
.default T
decorate(@NotNull TextDecoration @NotNull ... decorations)
Setsdecorations
toTextDecoration.State.TRUE
.default T
decoration(@NotNull TextDecoration decoration, boolean flag)
Sets the state of a decoration.T
decoration(@NotNull TextDecoration decoration, @NotNull TextDecoration.State state)
Sets the value of a decoration.T
decorationIfAbsent(@NotNull TextDecoration decoration, @NotNull TextDecoration.State state)
Sets the state of a decoration tostate
if the current state of the decoration isTextDecoration.State.NOT_SET
.T
decorations(@NotNull java.util.Map<TextDecoration,TextDecoration.State> decorations)
Sets decorations using the specifieddecorations
map.default T
decorations(@NotNull java.util.Set<TextDecoration> decorations, boolean flag)
Sets the state of a set of decorations toflag
.T
font(@Nullable Key font)
Sets the font.T
hoverEvent(@Nullable HoverEventSource<?> source)
Sets the hover event.T
insertion(@Nullable java.lang.String insertion)
Sets the string to be inserted when this object (T
) is shift-clicked.
-
-
-
Method Detail
-
font
@NotNull T font(@Nullable @Nullable Key font)
Sets the font.- Parameters:
font
- the font- Returns:
- an object (
T
) - Since:
- 4.10.0
- Since Minecraft:
- 1.16
-
color
@NotNull T color(@Nullable @Nullable TextColor color)
Sets the color.- Parameters:
color
- the color- Returns:
- an object (
T
) - Since:
- 4.10.0
-
colorIfAbsent
@NotNull T colorIfAbsent(@Nullable @Nullable TextColor color)
Sets the color if there isn't one set already.- Parameters:
color
- the color- Returns:
- an object (
T
) - Since:
- 4.10.0
-
decorate
@NotNull default T decorate(@NotNull @NotNull TextDecoration decoration)
Sets the state ofdecoration
toTextDecoration.State.TRUE
.- Parameters:
decoration
- the decoration- Returns:
- an object (
T
) - Since:
- 4.10.0
-
decorate
@NotNull default T decorate(@NotNull @NotNull TextDecoration @NotNull ... decorations)
Setsdecorations
toTextDecoration.State.TRUE
.- Parameters:
decorations
- the decorations- Returns:
- an object (
T
) - Since:
- 4.10.0
-
decoration
@NotNull default T decoration(@NotNull @NotNull TextDecoration decoration, boolean flag)
Sets the state of a decoration.- Parameters:
decoration
- the decorationflag
-true
if this object should have the decoration,false
if this object should not have the decoration- Returns:
- an object (
T
) - Since:
- 4.10.0
-
decoration
@NotNull T decoration(@NotNull @NotNull TextDecoration decoration, @NotNull TextDecoration.State state)
Sets the value of a decoration.- Parameters:
decoration
- the decorationstate
-TextDecoration.State.TRUE
if this object should have the decoration,TextDecoration.State.FALSE
if this object should not have the decoration, andTextDecoration.State.NOT_SET
if the decoration should not have a set value- Returns:
- an object (
T
) - Since:
- 4.10.0
-
decorationIfAbsent
@NotNull T decorationIfAbsent(@NotNull @NotNull TextDecoration decoration, @NotNull TextDecoration.State state)
Sets the state of a decoration tostate
if the current state of the decoration isTextDecoration.State.NOT_SET
.- Parameters:
decoration
- the decorationstate
- the state- Returns:
- an object (
T
) - Since:
- 4.12.0
-
decorations
@NotNull T decorations(@NotNull @NotNull java.util.Map<TextDecoration,TextDecoration.State> decorations)
Sets decorations using the specifieddecorations
map.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:
- an object (
T
) - Since:
- 4.10.0
-
decorations
@NotNull default T decorations(@NotNull @NotNull java.util.Set<TextDecoration> decorations, boolean flag)
Sets the state of a set of decorations toflag
.- Parameters:
decorations
- the decorationsflag
-true
if this builder should have the decorations,false
if this builder should not have the decorations- Returns:
- an object (
T
) - Since:
- 4.10.0
-
clickEvent
@NotNull T clickEvent(@Nullable @Nullable ClickEvent event)
Sets the click event.- Parameters:
event
- the click event- Returns:
- an object (
T
) - Since:
- 4.10.0
-
hoverEvent
@NotNull T hoverEvent(@Nullable @Nullable HoverEventSource<?> source)
Sets the hover event.- Parameters:
source
- the hover event source- Returns:
- an object (
T
) - Since:
- 4.10.0
-
insertion
@NotNull T insertion(@Nullable @Nullable java.lang.String insertion)
Sets the string to be inserted when this object (T
) is shift-clicked.- Parameters:
insertion
- the insertion string- Returns:
- an object (
T
) - Since:
- 4.10.0
-
-