Package net.kyori.adventure.text
Interface ScopedComponent<C extends Component>
- Type Parameters:
C
- the component type
- All Superinterfaces:
Component
,ComponentBuilderApplicable
,ComponentLike
,net.kyori.examination.Examinable
,HoverEventSource<Component>
,StyleGetter
,StyleSetter<Component>
- All Known Subinterfaces:
BlockNBTComponent
,EntityNBTComponent
,KeybindComponent
,ScoreComponent
,SelectorComponent
,StorageNBTComponent
,TextComponent
,TranslatableComponent
,VirtualComponent
Some magic to change return types.
- Since:
- 4.0.0
-
Field Summary
Fields inherited from interface net.kyori.adventure.text.Component
EQUALS, EQUALS_IDENTITY, IS_NOT_EMPTY
-
Method Summary
Modifier and TypeMethodDescriptiondefault C
Appends a component to this component.default C
append
(@NotNull ComponentBuilder<?, ?> builder) Appends a component to this component.default C
append
(@NotNull ComponentLike like) Appends a component to this component.default C
Appends a newline to this component.default C
Appends a space to this component.default C
applyFallbackStyle
(@NotNull Style style) Apply a fallback style for this component and its children.default C
applyFallbackStyle
(@NotNull StyleBuilderApplicable @NotNull ... style) Apply a fallback style for this component and its children.default C
Gets aComponent
representation.children
(@NotNull List<? extends ComponentLike> children) Sets the list of children.default C
clickEvent
(@Nullable ClickEvent event) Sets the click event of this component.default C
Sets the color of this component.default C
colorIfAbsent
(@Nullable TextColor color) Sets the color if there isn't one set already.default C
decorate
(@NotNull TextDecoration decoration) Sets the state ofdecoration
toTextDecoration.State.TRUE
on this component.default C
decoration
(@NotNull TextDecoration decoration, boolean flag) Sets the state of a decoration on this component.default C
decoration
(@NotNull TextDecoration decoration, @NotNull TextDecoration.State state) Sets the value of a decoration on this component.default C
decorationIfAbsent
(@NotNull TextDecoration decoration, @NotNull TextDecoration.State state) Sets the state of a decoration on this component tostate
if the current state of the decoration isTextDecoration.State.NOT_SET
.default C
decorations
(@NotNull Map<TextDecoration, TextDecoration.State> decorations) Sets decorations for this component's style using the specifieddecorations
map.default C
Sets the font.default C
hoverEvent
(@Nullable HoverEventSource<?> event) Sets the hover event of this component.default C
Sets the string to be inserted when this component is shift-clicked.default C
mergeStyle
(@NotNull Component that) Merges from another style into this component's style.default C
mergeStyle
(@NotNull Component that, @NotNull Set<Style.Merge> merges) Merges from another style into this component's style.default C
mergeStyle
(@NotNull Component that, @NotNull Style.Merge @NotNull ... merges) Merges from another style into this component's style.default C
shadowColor
(@Nullable ARGBLike argb) Sets the shadow color of this component.default C
shadowColorIfAbsent
(@Nullable ARGBLike argb) Sets the shadow color if there isn't one set already.default C
style
(@NotNull Consumer<Style.Builder> style) Sets the style of this component.default C
style
(@NotNull Consumer<Style.Builder> consumer, @NotNull Style.Merge.Strategy strategy) Sets the style of this component.Sets the style of this component.default C
style
(@NotNull Style.Builder style) Sets the style of this component.Methods inherited from interface net.kyori.adventure.text.Component
asHoverEvent, children, clickEvent, color, compact, componentBuilderApply, contains, contains, decoration, decorations, detectCycle, examinableProperties, font, hasDecoration, hasStyling, hoverEvent, insertion, iterable, iterable, iterator, iterator, replaceFirstText, replaceFirstText, replaceText, replaceText, replaceText, replaceText, replaceText, replaceText, replaceText, replaceText, shadowColor, spliterator, spliterator, style
Methods inherited from interface net.kyori.examination.Examinable
examinableName, examine
Methods inherited from interface net.kyori.adventure.text.event.HoverEventSource
asHoverEvent
Methods inherited from interface net.kyori.adventure.text.format.StyleSetter
decorate, decorations
-
Method Details
-
asComponent
Description copied from interface:ComponentLike
Gets aComponent
representation.- Specified by:
asComponent
in interfaceComponent
- Specified by:
asComponent
in interfaceComponentLike
- Returns:
- a component
-
children
Description copied from interface:Component
Sets the list of children.The contents of
children
will be copied. -
style
Description copied from interface:Component
Sets the style of this component. -
style
Description copied from interface:Component
Sets the style of this component. -
style
Description copied from interface:Component
Sets the style of this component. -
style
@NotNull default C style(@NotNull @NotNull Consumer<Style.Builder> consumer, @NotNull Style.Merge.Strategy strategy) Description copied from interface:Component
Sets the style of this component. -
mergeStyle
Description copied from interface:Component
Merges from another style into this component's style.- Specified by:
mergeStyle
in interfaceComponent
- Parameters:
that
- the other style- Returns:
- a component
-
mergeStyle
@NotNull default C mergeStyle(@NotNull @NotNull Component that, @NotNull Style.Merge @NotNull ... merges) Description copied from interface:Component
Merges from another style into this component's style.- Specified by:
mergeStyle
in interfaceComponent
- Parameters:
that
- the other stylemerges
- the style parts to merge- Returns:
- a component
-
append
Description copied from interface:Component
Appends a component to this component. -
append
Description copied from interface:Component
Appends a component to this component. -
append
Description copied from interface:Component
Appends a component to this component. -
appendNewline
Description copied from interface:Component
Appends a newline to this component.- Specified by:
appendNewline
in interfaceComponent
- Returns:
- a component with the newline added
-
appendSpace
Description copied from interface:Component
Appends a space to this component.- Specified by:
appendSpace
in interfaceComponent
- Returns:
- a component with the space added
-
applyFallbackStyle
Description copied from interface:Component
Apply a fallback style for this component and its children.This method can be used to set the "default" style for a component, whilst still allowing children of the component to override the style.
- Specified by:
applyFallbackStyle
in interfaceComponent
- Parameters:
style
- style to be used as a fallback- Returns:
- the styled component
-
applyFallbackStyle
Description copied from interface:Component
Apply a fallback style for this component and its children.This method can be used to set the "default" style for a component, whilst still allowing children of the component to override the style.
- Specified by:
applyFallbackStyle
in interfaceComponent
- Parameters:
style
- style to be used as a fallback- Returns:
- the styled component
-
mergeStyle
@NotNull default C mergeStyle(@NotNull @NotNull Component that, @NotNull @NotNull Set<Style.Merge> merges) Description copied from interface:Component
Merges from another style into this component's style.- Specified by:
mergeStyle
in interfaceComponent
- Parameters:
that
- the other stylemerges
- the style parts to merge- Returns:
- a component
-
color
Description copied from interface:Component
Sets the color of this component. -
colorIfAbsent
Description copied from interface:Component
Sets the color if there isn't one set already.- Specified by:
colorIfAbsent
in interfaceComponent
- Specified by:
colorIfAbsent
in interfaceStyleSetter<C extends Component>
- Parameters:
color
- the color- Returns:
- a component
-
shadowColor
Description copied from interface:Component
Sets the shadow color of this component.- Specified by:
shadowColor
in interfaceComponent
- Specified by:
shadowColor
in interfaceStyleSetter<C extends Component>
- Parameters:
argb
- the color- Returns:
- a component
-
shadowColorIfAbsent
Description copied from interface:Component
Sets the shadow color if there isn't one set already.- Specified by:
shadowColorIfAbsent
in interfaceComponent
- Specified by:
shadowColorIfAbsent
in interfaceStyleSetter<C extends Component>
- Parameters:
argb
- the color- Returns:
- a component
-
decorate
Description copied from interface:Component
Sets the state ofdecoration
toTextDecoration.State.TRUE
on this component. -
decoration
Description copied from interface:Component
Sets the state of a decoration on this component.- Specified by:
decoration
in interfaceComponent
- Specified by:
decoration
in interfaceStyleSetter<C extends Component>
- Parameters:
decoration
- the decorationflag
-true
if this component should have the decoration,false
if this component should not have the decoration- Returns:
- a component
-
decoration
@NotNull default C decoration(@NotNull @NotNull TextDecoration decoration, @NotNull TextDecoration.State state) Description copied from interface:Component
Sets the value of a decoration on this component.- Specified by:
decoration
in interfaceComponent
- Specified by:
decoration
in interfaceStyleSetter<C extends Component>
- 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:
- a component
-
decorationIfAbsent
@NotNull default C decorationIfAbsent(@NotNull @NotNull TextDecoration decoration, @NotNull TextDecoration.State state) Description copied from interface:Component
Sets the state of a decoration on this component tostate
if the current state of the decoration isTextDecoration.State.NOT_SET
.- Specified by:
decorationIfAbsent
in interfaceComponent
- Specified by:
decorationIfAbsent
in interfaceStyleSetter<C extends Component>
- Parameters:
decoration
- the decorationstate
- the state- Returns:
- a component
-
decorations
@NotNull default C decorations(@NotNull @NotNull Map<TextDecoration, TextDecoration.State> decorations) Description copied from interface:Component
Sets decorations for this component's 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 interfaceComponent
- Specified by:
decorations
in interfaceStyleSetter<C extends Component>
- Parameters:
decorations
- a set of default values- Returns:
- a component
-
clickEvent
Description copied from interface:Component
Sets the click event of this component.- Specified by:
clickEvent
in interfaceComponent
- Specified by:
clickEvent
in interfaceStyleSetter<C extends Component>
- Parameters:
event
- the click event- Returns:
- a component
-
hoverEvent
Description copied from interface:Component
Sets the hover event of this component.- Specified by:
hoverEvent
in interfaceComponent
- Specified by:
hoverEvent
in interfaceStyleSetter<C extends Component>
- Parameters:
event
- the hover event source- Returns:
- a component
-
insertion
Description copied from interface:Component
Sets the string to be inserted when this component is shift-clicked. -
font
Description copied from interface:Component
Sets the font.
-