Package net.kyori.adventure.text
Interface ComponentBuilder<C extends BuildableComponent<C,B>,B extends ComponentBuilder<C,B>>
- 
- Type Parameters:
- C- the component type
- B- the builder type
 - All Superinterfaces:
- AbstractBuilder<C>,- Buildable.Builder<C>,- ComponentBuilderApplicable,- ComponentLike,- MutableStyleSetter<B>,- StyleSetter<B>
 - All Known Subinterfaces:
- BlockNBTComponent.Builder,- EntityNBTComponent.Builder,- KeybindComponent.Builder,- NBTComponentBuilder<C,B>,- ScoreComponent.Builder,- SelectorComponent.Builder,- StorageNBTComponent.Builder,- TextComponent.Builder,- TranslatableComponent.Builder
 
 @NonExtendable public interface ComponentBuilder<C extends BuildableComponent<C,B>,B extends ComponentBuilder<C,B>> extends AbstractBuilder<C>, Buildable.Builder<C>, ComponentBuilderApplicable, ComponentLike, MutableStyleSetter<B> A component builder.- Since:
- 4.0.0
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Bappend(@NotNull java.lang.Iterable<? extends ComponentLike> components)Appends components to this component.Bappend(@NotNull Component component)Appends a component to this component.Bappend(@NotNull Component @NotNull ... components)Appends components to this component.default Bappend(@NotNull ComponentBuilder<?,?> builder)Appends a component to this component.default Bappend(@NotNull ComponentLike component)Appends a component to this component.Bappend(@NotNull ComponentLike @NotNull ... components)Appends components to this component.default BappendNewline()Appends a newline to this component.default BappendSpace()Appends a space to this component.default BapplicableApply(@NotNull ComponentBuilderApplicable applicable)Appliesapplicable.default Bapply(@NotNull java.util.function.Consumer<? super ComponentBuilder<?,?>> consumer)Applies an action to this builder.BapplyDeep(@NotNull java.util.function.Consumer<? super ComponentBuilder<?,?>> action)Applies an action to this component and all child components if they are an instance ofBuildableComponent.default @NotNull ComponentasComponent()Gets aComponentrepresentation.Cbuild()Build a component.@NotNull java.util.List<Component>children()Get an unmodifiable list containing all children currently in this builder.BclickEvent(@Nullable ClickEvent event)Sets the click event of this component.Bcolor(@Nullable TextColor color)Sets the color of this component.BcolorIfAbsent(@Nullable TextColor color)Sets the color of this component if there isn't one set already.default voidcomponentBuilderApply(@NotNull ComponentBuilder<?,?> component)Applies tocomponent.default Bdecorate(@NotNull TextDecoration decoration)Sets the state ofdecorationtoTextDecoration.State.TRUE.default Bdecorate(@NotNull TextDecoration @NotNull ... decorations)SetsdecorationstoTextDecoration.State.TRUE.default Bdecoration(@NotNull TextDecoration decoration, boolean flag)Sets the state of a decoration on this component.Bdecoration(@NotNull TextDecoration decoration, @NotNull TextDecoration.State state)Sets the value of a decoration on this component.BdecorationIfAbsent(@NotNull TextDecoration decoration, @NotNull TextDecoration.State state)Sets the state of a decoration on this component tostateif the current state of the decoration isTextDecoration.State.NOT_SET.default Bdecorations(@NotNull java.util.Map<TextDecoration,TextDecoration.State> decorations)Sets decorations for this component's style using the specifieddecorationsmap.default Bdecorations(@NotNull java.util.Set<TextDecoration> decorations, boolean flag)Sets the state of a set of decorations toflagon this component.Bfont(@Nullable Key font)Sets the font of this component.BhoverEvent(@Nullable HoverEventSource<?> source)Sets the hover event of this component.Binsertion(@Nullable java.lang.String insertion)Sets the string to be inserted when this component is shift-clicked.BmapChildren(@NotNull java.util.function.Function<BuildableComponent<?,?>,? extends BuildableComponent<?,?>> function)Replaces each child of this component with the resultant component from the function.BmapChildrenDeep(@NotNull java.util.function.Function<BuildableComponent<?,?>,? extends BuildableComponent<?,?>> function)Replaces each child and sub-child of this component with the resultant component of the function.default BmergeStyle(@NotNull Component that)Merges styling from another component into this component.BmergeStyle(@NotNull Component that, @NotNull java.util.Set<Style.Merge> merges)Merges styling from another component into this component.default BmergeStyle(@NotNull Component that, @NotNull Style.Merge @NotNull ... merges)Merges styling from another component into this component.BresetStyle()Resets all styling on this component.Bstyle(@NotNull java.util.function.Consumer<Style.Builder> consumer)Configures the style.Bstyle(@NotNull Style style)Sets the style.
 
- 
- 
- 
Method Detail- 
append@Contract("_ -> this") @NotNull B append(@NotNull @NotNull Component component)Appends a component to this component.- Parameters:
- component- the component to append
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
append@Contract("_ -> this") @NotNull default B append(@NotNull @NotNull ComponentLike component)Appends a component to this component.- Parameters:
- component- the component to append
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
append@Contract("_ -> this") @NotNull default B append(@NotNull @NotNull ComponentBuilder<?,?> builder)Appends a component to this component.- Parameters:
- builder- the component to append
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
append@Contract("_ -> this") @NotNull B append(@NotNull @NotNull Component @NotNull ... components)Appends components to this component.- Parameters:
- components- the components to append
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
append@Contract("_ -> this") @NotNull B append(@NotNull @NotNull ComponentLike @NotNull ... components)Appends components to this component.- Parameters:
- components- the components to append
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
append@Contract("_ -> this") @NotNull B append(@NotNull @NotNull java.lang.Iterable<? extends ComponentLike> components)Appends components to this component.- Parameters:
- components- the components to append
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
appendNewline@NotNull default B appendNewline() Appends a newline to this component.- Returns:
- this builder
- Since:
- 4.12.0
 
 - 
appendSpace@NotNull default B appendSpace() Appends a space to this component.- Returns:
- this builder
- Since:
- 4.12.0
 
 - 
apply@Contract("_ -> this") @NotNull default B apply(@NotNull @NotNull java.util.function.Consumer<? super ComponentBuilder<?,?>> consumer)Applies an action to this builder.- Parameters:
- consumer- the action
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
applyDeep@Contract("_ -> this") @NotNull B applyDeep(@NotNull @NotNull java.util.function.Consumer<? super ComponentBuilder<?,?>> action)Applies an action to this component and all child components if they are an instance ofBuildableComponent.- Parameters:
- action- the action
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
mapChildren@Contract("_ -> this") @NotNull B mapChildren(@NotNull @NotNull java.util.function.Function<BuildableComponent<?,?>,? extends BuildableComponent<?,?>> function)Replaces each child of this component with the resultant component from the function.- Parameters:
- function- the mapping function
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
mapChildrenDeep@Contract("_ -> this") @NotNull B mapChildrenDeep(@NotNull @NotNull java.util.function.Function<BuildableComponent<?,?>,? extends BuildableComponent<?,?>> function)Replaces each child and sub-child of this component with the resultant component of the function.- Parameters:
- function- the mapping function
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
children@NotNull @NotNull java.util.List<Component> children() Get an unmodifiable list containing all children currently in this builder.- Returns:
- the list of children
- Since:
- 4.6.0
 
 - 
style@Contract("_ -> this") @NotNull B style(@NotNull @NotNull Style style)Sets the style.- Parameters:
- style- the style
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
style@Contract("_ -> this") @NotNull B style(@NotNull @NotNull java.util.function.Consumer<Style.Builder> consumer)Configures the style.- Parameters:
- consumer- the style consumer
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
font@Contract("_ -> this") @NotNull B font(@Nullable @Nullable Key font)Sets the font of this component.- Specified by:
- fontin interface- StyleSetter<C extends BuildableComponent<C,B>>
- Parameters:
- font- the font
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
color@Contract("_ -> this") @NotNull B color(@Nullable @Nullable TextColor color)Sets the color of this component.- Specified by:
- colorin interface- StyleSetter<C extends BuildableComponent<C,B>>
- Parameters:
- color- the color
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
colorIfAbsent@Contract("_ -> this") @NotNull B colorIfAbsent(@Nullable @Nullable TextColor color)Sets the color of this component if there isn't one set already.- Specified by:
- colorIfAbsentin interface- StyleSetter<C extends BuildableComponent<C,B>>
- Parameters:
- color- the color
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
decorations@Contract("_, _ -> this") @NotNull default B decorations(@NotNull @NotNull java.util.Set<TextDecoration> decorations, boolean flag)Sets the state of a set of decorations toflagon this component.- Specified by:
- decorationsin interface- MutableStyleSetter<C extends BuildableComponent<C,B>>
- Specified by:
- decorationsin interface- StyleSetter<C extends BuildableComponent<C,B>>
- Parameters:
- decorations- the decorations
- flag-- trueif this component should have the decorations,- falseif this component should not have the decorations
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
decorate@Contract("_ -> this") @NotNull default B decorate(@NotNull @NotNull TextDecoration decoration)Sets the state ofdecorationtoTextDecoration.State.TRUE.- Specified by:
- decoratein interface- StyleSetter<C extends BuildableComponent<C,B>>
- Parameters:
- decoration- the decoration
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
decorate@Contract("_ -> this") @NotNull default B decorate(@NotNull @NotNull TextDecoration @NotNull ... decorations)SetsdecorationstoTextDecoration.State.TRUE.- Specified by:
- decoratein interface- MutableStyleSetter<C extends BuildableComponent<C,B>>
- Specified by:
- decoratein interface- StyleSetter<C extends BuildableComponent<C,B>>
- Parameters:
- decorations- the decorations
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
decoration@Contract("_, _ -> this") @NotNull default B decoration(@NotNull @NotNull TextDecoration decoration, boolean flag)Sets the state of a decoration on this component.- Specified by:
- decorationin interface- StyleSetter<C extends BuildableComponent<C,B>>
- Parameters:
- decoration- the decoration
- flag-- trueif this component should have the decoration,- falseif this component should not have the decoration
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
decorations@Contract("_ -> this") @NotNull default B decorations(@NotNull @NotNull java.util.Map<TextDecoration,TextDecoration.State> decorations)Sets decorations for this component's style using the specifieddecorationsmap.If a given decoration does not have a value explicitly set, the value of that particular decoration is not changed. - Specified by:
- decorationsin interface- MutableStyleSetter<C extends BuildableComponent<C,B>>
- Specified by:
- decorationsin interface- StyleSetter<C extends BuildableComponent<C,B>>
- Parameters:
- decorations- a map containing text decorations and their respective state.
- Returns:
- this builder
- Since:
- 4.10.0
 
 - 
decoration@Contract("_, _ -> this") @NotNull B decoration(@NotNull @NotNull TextDecoration decoration, @NotNull TextDecoration.State state)Sets the value of a decoration on this component.- Specified by:
- decorationin interface- StyleSetter<C extends BuildableComponent<C,B>>
- Parameters:
- decoration- the decoration
- state-- TextDecoration.State.TRUEif this component should have the decoration,- TextDecoration.State.FALSEif this component should not have the decoration, and- TextDecoration.State.NOT_SETif the decoration should not have a set value
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
decorationIfAbsent@Contract("_, _ -> this") @NotNull B decorationIfAbsent(@NotNull @NotNull TextDecoration decoration, @NotNull TextDecoration.State state)Sets the state of a decoration on this component tostateif the current state of the decoration isTextDecoration.State.NOT_SET.- Specified by:
- decorationIfAbsentin interface- StyleSetter<C extends BuildableComponent<C,B>>
- Parameters:
- decoration- the decoration
- state- the state
- Returns:
- this builder
- Since:
- 4.12.0
 
 - 
clickEvent@Contract("_ -> this") @NotNull B clickEvent(@Nullable @Nullable ClickEvent event)Sets the click event of this component.- Specified by:
- clickEventin interface- StyleSetter<C extends BuildableComponent<C,B>>
- Parameters:
- event- the click event
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
hoverEvent@Contract("_ -> this") @NotNull B hoverEvent(@Nullable @Nullable HoverEventSource<?> source)Sets the hover event of this component.- Specified by:
- hoverEventin interface- StyleSetter<C extends BuildableComponent<C,B>>
- Parameters:
- source- the hover event source
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
insertion@Contract("_ -> this") @NotNull B insertion(@Nullable @Nullable java.lang.String insertion)Sets the string to be inserted when this component is shift-clicked.- Specified by:
- insertionin interface- StyleSetter<C extends BuildableComponent<C,B>>
- Parameters:
- insertion- the insertion string
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
mergeStyle@Contract("_ -> this") @NotNull default B mergeStyle(@NotNull @NotNull Component that)Merges styling from another component into this component.- Parameters:
- that- the other component
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
mergeStyle@Contract("_, _ -> this") @NotNull default B mergeStyle(@NotNull @NotNull Component that, @NotNull Style.Merge @NotNull ... merges)Merges styling from another component into this component.- Parameters:
- that- the other component
- merges- the parts to merge
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
mergeStyle@Contract("_, _ -> this") @NotNull B mergeStyle(@NotNull @NotNull Component that, @NotNull @NotNull java.util.Set<Style.Merge> merges)Merges styling from another component into this component.- Parameters:
- that- the other component
- merges- the parts to merge
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
resetStyle@NotNull B resetStyle() Resets all styling on this component.- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
build@NotNull C build() Build a component.- Specified by:
- buildin interface- AbstractBuilder<C extends BuildableComponent<C,B>>
- Specified by:
- buildin interface- Buildable.Builder<C extends BuildableComponent<C,B>>
- Returns:
- the component
 
 - 
applicableApply@Contract("_ -> this") @NotNull default B applicableApply(@NotNull @NotNull ComponentBuilderApplicable applicable)Appliesapplicable.- Parameters:
- applicable- the thing to apply
- Returns:
- this builder
- Since:
- 4.0.0
 
 - 
componentBuilderApplydefault void componentBuilderApply(@NotNull @NotNull ComponentBuilder<?,?> component)Description copied from interface:ComponentBuilderApplicableApplies tocomponent.- Specified by:
- componentBuilderApplyin interface- ComponentBuilderApplicable
- Parameters:
- component- the component builder
 
 - 
asComponent@NotNull default @NotNull Component asComponent() Description copied from interface:ComponentLikeGets aComponentrepresentation.- Specified by:
- asComponentin interface- ComponentLike
- Returns:
- a component
 
 
- 
 
-