Interface Component
-
- All Superinterfaces:
ComponentBuilderApplicable
,ComponentLike
,net.kyori.examination.Examinable
,HoverEventSource<Component>
,StyleGetter
,StyleSetter<Component>
- All Known Subinterfaces:
BlockNBTComponent
,BuildableComponent<C,B>
,EntityNBTComponent
,KeybindComponent
,NBTComponent<C,B>
,ScopedComponent<C>
,ScoreComponent
,SelectorComponent
,StorageNBTComponent
,TextComponent
,TranslatableComponent
- All Known Implementing Classes:
AbstractComponent
@NonExtendable public interface Component extends ComponentBuilderApplicable, ComponentLike, net.kyori.examination.Examinable, HoverEventSource<Component>, StyleGetter, StyleSetter<Component>
A Component is an immutable object that represents how text is displayed Minecraft clients.Components can be thought of as the combination of:
- The message the Component wants to display; and
- The
Style
of that message.
The most basic component is the
TextComponent
, where the message is a simple String. However, other dynamic Components are available, which are linked to from here and you are encouraged to explore to better support your plugin/mod. Factories and builders for all available component types are provided via this interface.Components can be serialized to and deserialized from other formats via the use of
component serializers
. If used within one of our natively supported platforms, the availability of such serializers may vary, consult the documentation or support for the given platform should this be the case.Further information about Components, along with functional examples of how they can be used, can be found on our documentation.
- Since:
- 4.0.0
- See Also:
BlockNBTComponent
,EntityNBTComponent
,KeybindComponent
,ScoreComponent
,SelectorComponent
,StorageNBTComponent
,TextComponent
,TranslatableComponent
,LinearComponents
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.function.BiPredicate<? super Component,? super Component>
EQUALS
A predicate that checks equality of twoComponent
s usingObjects.equals(Object, Object)
.static java.util.function.BiPredicate<? super Component,? super Component>
EQUALS_IDENTITY
A predicate that checks equality of twoComponent
s using identity equality.static java.util.function.Predicate<? super Component>
IS_NOT_EMPTY
A predicate that excludesempty()
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default @NotNull Component
append(@NotNull Component component)
Appends a component to this component.default @NotNull Component
append(@NotNull ComponentBuilder<?,?> builder)
Appends a component to this component.default @NotNull Component
append(@NotNull ComponentLike like)
Appends a component to this component.default @NotNull Component
appendNewline()
Appends a newline to this component.default @NotNull Component
appendSpace()
Appends a space to this component.default @NotNull Component
applyFallbackStyle(@NotNull Style style)
Apply a fallback style for this component and its children.default @NotNull Component
applyFallbackStyle(@NotNull StyleBuilderApplicable @NotNull ... style)
Apply a fallback style for this component and its children.default @NotNull Component
asComponent()
Gets aComponent
representation.default @NotNull HoverEvent<Component>
asHoverEvent(@NotNull java.util.function.UnaryOperator<Component> op)
Creates a hover event with value derived from this object.static @NotNull BlockNBTComponent.Builder
blockNBT()
Creates a block NBT component builder.static @NotNull BlockNBTComponent
blockNBT(@NotNull java.lang.String nbtPath, boolean interpret, @NotNull BlockNBTComponent.Pos pos)
Creates a block NBT component with a position.static @NotNull BlockNBTComponent
blockNBT(@NotNull java.lang.String nbtPath, boolean interpret, @Nullable ComponentLike separator, @NotNull BlockNBTComponent.Pos pos)
Creates a block NBT component with a position.static @NotNull BlockNBTComponent
blockNBT(@NotNull java.lang.String nbtPath, @NotNull BlockNBTComponent.Pos pos)
Creates a block NBT component with a position.static @NotNull BlockNBTComponent
blockNBT(@NotNull java.util.function.Consumer<? super BlockNBTComponent.Builder> consumer)
Creates a block NBT component by applying configuration fromconsumer
.@Unmodifiable @NotNull java.util.List<Component>
children()
Gets the unmodifiable list of children.@NotNull Component
children(@NotNull java.util.List<? extends ComponentLike> children)
Sets the list of children.default @Nullable ClickEvent
clickEvent()
Gets the click event of this component.default @NotNull Component
clickEvent(@Nullable ClickEvent event)
Sets the click event of this component.default @Nullable TextColor
color()
Gets the color of this component.default @NotNull Component
color(@Nullable TextColor color)
Sets the color of this component.default @NotNull Component
colorIfAbsent(@Nullable TextColor color)
Sets the color if there isn't one set already.default @NotNull Component
compact()
Create a new component with any redundant style elements or children removed.default void
componentBuilderApply(@NotNull ComponentBuilder<?,?> component)
Applies tocomponent
.default boolean
contains(@NotNull Component that)
Checks if this component contains a component.default boolean
contains(@NotNull Component that, @NotNull java.util.function.BiPredicate<? super Component,? super Component> equals)
Checks if this component contains a component.default @NotNull Component
decorate(@NotNull TextDecoration decoration)
Sets the state ofdecoration
toTextDecoration.State.TRUE
on this component.default @NotNull TextDecoration.State
decoration(@NotNull TextDecoration decoration)
Gets the state of a decoration on this component.default @NotNull Component
decoration(@NotNull TextDecoration decoration, boolean flag)
Sets the state of a decoration on this component.default @NotNull Component
decoration(@NotNull TextDecoration decoration, @NotNull TextDecoration.State state)
Sets the value of a decoration on this component.default @NotNull Component
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 @NotNull java.util.Map<TextDecoration,TextDecoration.State>
decorations()
Gets a set of decorations this component has.default @NotNull Component
decorations(@NotNull java.util.Map<TextDecoration,TextDecoration.State> decorations)
Sets decorations for this component's style using the specifieddecorations
map.default void
detectCycle(@NotNull Component that)
Deprecated.for removal since 4.7.0, with no replacement - this method is not necessary due to the factComponent
s are immutablestatic @NotNull TextComponent
empty()
Gets an empty component.static @NotNull EntityNBTComponent.Builder
entityNBT()
Creates an entity NBT component builder.static @NotNull EntityNBTComponent
entityNBT(@NotNull java.lang.String nbtPath, @NotNull java.lang.String selector)
Creates a entity NBT component with a position.static @NotNull EntityNBTComponent
entityNBT(@NotNull java.util.function.Consumer<? super EntityNBTComponent.Builder> consumer)
Creates a entity NBT component by applying configuration fromconsumer
.default @NotNull java.util.stream.Stream<? extends net.kyori.examination.ExaminableProperty>
examinableProperties()
default @Nullable Key
font()
Gets the font.default @NotNull Component
font(@Nullable Key key)
Sets the font.default boolean
hasDecoration(@NotNull TextDecoration decoration)
Tests if this component has a decoration.default boolean
hasStyling()
Tests if this component has any styling.default @Nullable HoverEvent<?>
hoverEvent()
Gets the hover event of this component.default @NotNull Component
hoverEvent(@Nullable HoverEventSource<?> source)
Sets the hover event of this component.default @Nullable java.lang.String
insertion()
Gets the string to be inserted when this component is shift-clicked.default @NotNull Component
insertion(@Nullable java.lang.String insertion)
Sets the string to be inserted when this component is shift-clicked.default @NotNull java.lang.Iterable<Component>
iterable(@NotNull ComponentIteratorType type, @NotNull java.util.Set<ComponentIteratorFlag> flags)
Returns an iterable view of this component.default @NotNull java.lang.Iterable<Component>
iterable(@NotNull ComponentIteratorType type, @NotNull ComponentIteratorFlag @Nullable ... flags)
Returns an iterable view of this component.default @NotNull java.util.Iterator<Component>
iterator(@NotNull ComponentIteratorType type, @NotNull java.util.Set<ComponentIteratorFlag> flags)
Returns an iterator for this component.default @NotNull java.util.Iterator<Component>
iterator(@NotNull ComponentIteratorType type, @NotNull ComponentIteratorFlag @Nullable ... flags)
Returns an iterator for this component.static @NotNull TextComponent
join(@NotNull ComponentLike separator, @NotNull ComponentLike @NotNull ... components)
Deprecated.for removal since 4.9.0, usejoin(JoinConfiguration, ComponentLike...)
withJoinConfiguration.separator(ComponentLike)
instead.static @NotNull TextComponent
join(@NotNull ComponentLike separator, java.lang.Iterable<? extends ComponentLike> components)
Deprecated.for removal since 4.9.0, usejoin(JoinConfiguration, Iterable)
withJoinConfiguration.separator(ComponentLike)
instead.static @NotNull Component
join(@NotNull JoinConfiguration.Builder configBuilder, @NotNull java.lang.Iterable<? extends ComponentLike> components)
Joinscomponents
using the configuration inconfigBuilder
.static @NotNull Component
join(@NotNull JoinConfiguration.Builder configBuilder, @NotNull ComponentLike @NotNull ... components)
Joinscomponents
using the configuration inconfigBuilder
.static @NotNull Component
join(@NotNull JoinConfiguration config, @NotNull java.lang.Iterable<? extends ComponentLike> components)
Joinscomponents
using the configuration inconfig
.static @NotNull Component
join(@NotNull JoinConfiguration config, @NotNull ComponentLike @NotNull ... components)
Joinscomponents
using the configuration inconfig
.static @NotNull KeybindComponent.Builder
keybind()
Creates a keybind component builder.static @NotNull KeybindComponent
keybind(@NotNull java.lang.String keybind)
Creates a keybind component with a keybind.static @NotNull KeybindComponent
keybind(@NotNull java.lang.String keybind, @NotNull Style style)
Creates a keybind component with a keybind and styling.static @NotNull KeybindComponent
keybind(@NotNull java.lang.String keybind, @Nullable TextColor color)
Creates a keybind component with a keybind, and optional color.static @NotNull KeybindComponent
keybind(@NotNull java.lang.String keybind, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations)
Creates a keybind component with a keybind, and optional color and decorations.static @NotNull KeybindComponent
keybind(@NotNull java.lang.String keybind, @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a keybind component with a keybind, and optional color and decorations.static @NotNull KeybindComponent
keybind(@NotNull java.util.function.Consumer<? super KeybindComponent.Builder> consumer)
Creates a keybind component by applying configuration fromconsumer
.static @NotNull KeybindComponent
keybind(@NotNull KeybindComponent.KeybindLike keybind)
Creates a keybind component with a keybind.static @NotNull KeybindComponent
keybind(@NotNull KeybindComponent.KeybindLike keybind, @NotNull Style style)
Creates a keybind component with a keybind and styling.static @NotNull KeybindComponent
keybind(@NotNull KeybindComponent.KeybindLike keybind, @Nullable TextColor color)
Creates a keybind component with a keybind, and optional color.static @NotNull KeybindComponent
keybind(@NotNull KeybindComponent.KeybindLike keybind, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations)
Creates a keybind component with a keybind, and optional color and decorations.static @NotNull KeybindComponent
keybind(@NotNull KeybindComponent.KeybindLike keybind, @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a keybind component with a keybind, and optional color and decorations.default @NotNull Component
mergeStyle(@NotNull Component that)
Merges from another style into this component's style.default @NotNull Component
mergeStyle(@NotNull Component that, @NotNull java.util.Set<Style.Merge> merges)
Merges from another style into this component's style.default @NotNull Component
mergeStyle(@NotNull Component that, @NotNull Style.Merge @NotNull ... merges)
Merges from another style into this component's style.static @NotNull TextComponent
newline()
Gets a text component with a new line character as the content.default @NotNull Component
replaceFirstText(@NotNull java.lang.String search, @Nullable ComponentLike replacement)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.default @NotNull Component
replaceFirstText(@NotNull java.util.regex.Pattern pattern, @NotNull java.util.function.Function<TextComponent.Builder,@Nullable ComponentLike> replacement)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.default @NotNull Component
replaceText(@NotNull java.lang.String search, @Nullable ComponentLike replacement)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.default @NotNull Component
replaceText(@NotNull java.lang.String search, @Nullable ComponentLike replacement, int numberOfReplacements)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.default @NotNull Component
replaceText(@NotNull java.lang.String search, @Nullable ComponentLike replacement, @NotNull IntFunction2<PatternReplacementResult> fn)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.default @NotNull Component
replaceText(@NotNull java.util.function.Consumer<TextReplacementConfig.Builder> configurer)
Finds and replaces any text with this or childComponent
s using the configured options.default @NotNull Component
replaceText(@NotNull java.util.regex.Pattern pattern, @NotNull java.util.function.Function<TextComponent.Builder,@Nullable ComponentLike> replacement)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.default @NotNull Component
replaceText(@NotNull java.util.regex.Pattern pattern, @NotNull java.util.function.Function<TextComponent.Builder,@Nullable ComponentLike> replacement, int numberOfReplacements)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.default @NotNull Component
replaceText(@NotNull java.util.regex.Pattern pattern, @NotNull java.util.function.Function<TextComponent.Builder,@Nullable ComponentLike> replacement, @NotNull IntFunction2<PatternReplacementResult> fn)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.default @NotNull Component
replaceText(@NotNull TextReplacementConfig config)
Finds and replaces any text with this or childComponent
s using the provided options.static @NotNull ScoreComponent.Builder
score()
Creates a score component builder.static @NotNull ScoreComponent
score(@NotNull java.lang.String name, @NotNull java.lang.String objective)
Creates a score component with a name and objective.static @NotNull ScoreComponent
score(@NotNull java.lang.String name, @NotNull java.lang.String objective, @Nullable java.lang.String value)
Deprecated.since 4.7.0, not for removal, with no replacement.static @NotNull ScoreComponent
score(@NotNull java.util.function.Consumer<? super ScoreComponent.Builder> consumer)
Creates a score component by applying configuration fromconsumer
.static @NotNull SelectorComponent.Builder
selector()
Creates a selector component builder.static @NotNull SelectorComponent
selector(@NotNull java.lang.String pattern)
Creates a selector component with a pattern.static @NotNull SelectorComponent
selector(@NotNull java.lang.String pattern, @Nullable ComponentLike separator)
Creates a selector component with a pattern.static @NotNull SelectorComponent
selector(@NotNull java.util.function.Consumer<? super SelectorComponent.Builder> consumer)
Creates a selector component by applying configuration fromconsumer
.static @NotNull TextComponent
space()
Gets a text immutable component with a single space as the content.default @NotNull java.util.Spliterator<Component>
spliterator(@NotNull ComponentIteratorType type, @NotNull java.util.Set<ComponentIteratorFlag> flags)
Returns a spliterator for this component.default @NotNull java.util.Spliterator<Component>
spliterator(@NotNull ComponentIteratorType type, @NotNull ComponentIteratorFlag @Nullable ... flags)
Returns a spliterator for this component.static @NotNull StorageNBTComponent.Builder
storageNBT()
Creates an storage NBT component builder.static @NotNull StorageNBTComponent
storageNBT(@NotNull java.lang.String nbtPath, boolean interpret, @NotNull Key storage)
Creates a storage NBT component with a path and an storage ID.static @NotNull StorageNBTComponent
storageNBT(@NotNull java.lang.String nbtPath, boolean interpret, @Nullable ComponentLike separator, @NotNull Key storage)
Creates a storage NBT component with a path and an storage ID.static @NotNull StorageNBTComponent
storageNBT(@NotNull java.lang.String nbtPath, @NotNull Key storage)
Creates a storage NBT component with a path and an storage ID.static @NotNull StorageNBTComponent
storageNBT(@NotNull java.util.function.Consumer<? super StorageNBTComponent.Builder> consumer)
Creates a storage NBT component by applying configuration fromconsumer
.@NotNull Style
style()
Gets the style of this component.default @NotNull Component
style(@NotNull java.util.function.Consumer<Style.Builder> consumer)
Sets the style of this component.default @NotNull Component
style(@NotNull java.util.function.Consumer<Style.Builder> consumer, @NotNull Style.Merge.Strategy strategy)
Sets the style of this component.@NotNull Component
style(@NotNull Style style)
Sets the style of this component.default @NotNull Component
style(@NotNull Style.Builder style)
Sets the style of this component.static @NotNull TextComponent.Builder
text()
Creates a text component builder.static @NotNull TextComponent
text(boolean value)
Creates a text component with the content ofString.valueOf(boolean)
.static @NotNull TextComponent
text(boolean value, @NotNull Style style)
Creates a text component with the content ofString.valueOf(boolean)
and styling.static @NotNull TextComponent
text(boolean value, @Nullable TextColor color)
Creates a text component with the content ofString.valueOf(boolean)
, and optional color.static @NotNull TextComponent
text(boolean value, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations)
Creates a text component with the content ofString.valueOf(boolean)
, and optional color and decorations.static @NotNull TextComponent
text(boolean value, @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a text component with the content ofString.valueOf(boolean)
, and optional color and decorations.static @NotNull TextComponent
text(char value)
Creates a text component with the content ofString.valueOf(char)
.static @NotNull TextComponent
text(char value, @NotNull Style style)
Creates a text component with the content ofString.valueOf(char)
and styling.static @NotNull TextComponent
text(char value, @Nullable TextColor color)
Creates a text component with the content ofString.valueOf(char)
, and optional color.static @NotNull TextComponent
text(char value, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations)
Creates a text component with the content ofString.valueOf(char)
, and optional color and decorations.static @NotNull TextComponent
text(char value, @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a text component with the content ofString.valueOf(char)
, and optional color and decorations.static @NotNull TextComponent
text(double value)
Creates a text component with the content ofString.valueOf(double)
.static @NotNull TextComponent
text(double value, @NotNull Style style)
Creates a text component with the content ofString.valueOf(double)
and styling.static @NotNull TextComponent
text(double value, @Nullable TextColor color)
Creates a text component with the content ofString.valueOf(double)
, and optional color.static @NotNull TextComponent
text(double value, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations)
Creates a text component with the content ofString.valueOf(double)
, and optional color and decorations.static @NotNull TextComponent
text(double value, @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a text component with the content ofString.valueOf(double)
, and optional color and decorations.static @NotNull TextComponent
text(float value)
Creates a text component with the content ofString.valueOf(float)
.static @NotNull TextComponent
text(float value, @NotNull Style style)
Creates a text component with the content ofString.valueOf(float)
and styling.static @NotNull TextComponent
text(float value, @Nullable TextColor color)
Creates a text component with the content ofString.valueOf(float)
, and optional color.static @NotNull TextComponent
text(float value, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations)
Creates a text component with the content ofString.valueOf(float)
, and optional color and decorations.static @NotNull TextComponent
text(float value, @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a text component with the content ofString.valueOf(float)
, and optional color and decorations.static @NotNull TextComponent
text(int value)
Creates a text component with the content ofString.valueOf(int)
.static @NotNull TextComponent
text(int value, @NotNull Style style)
Creates a text component with the content ofString.valueOf(int)
and styling.static @NotNull TextComponent
text(int value, @Nullable TextColor color)
Creates a text component with the content ofString.valueOf(int)
, and optional color.static @NotNull TextComponent
text(int value, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations)
Creates a text component with the content ofString.valueOf(int)
, and optional color and decorations.static @NotNull TextComponent
text(int value, @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a text component with the content ofString.valueOf(int)
, and optional color and decorations.static @NotNull TextComponent
text(long value)
Creates a text component with the content ofString.valueOf(long)
.static @NotNull TextComponent
text(long value, @NotNull Style style)
Creates a text component with the content ofString.valueOf(long)
and styling.static @NotNull TextComponent
text(long value, @Nullable TextColor color)
Creates a text component with the content ofString.valueOf(long)
, and optional color.static @NotNull TextComponent
text(long value, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations)
Creates a text component with the content ofString.valueOf(long)
, and optional color and decorations.static @NotNull TextComponent
text(long value, @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a text component with the content ofString.valueOf(long)
, and optional color and decorations.static @NotNull TextComponent
text(@NotNull java.lang.String content)
Creates a text component with content.static @NotNull TextComponent
text(@NotNull java.lang.String content, @NotNull Style style)
Creates a text component with content and styling.static @NotNull TextComponent
text(@NotNull java.lang.String content, @Nullable TextColor color)
Creates a text component with content, and optional color.static @NotNull TextComponent
text(@NotNull java.lang.String content, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations)
Creates a text component with content, and optional color and decorations.static @NotNull TextComponent
text(@NotNull java.lang.String content, @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a text component with content, and optional color and decorations.static @NotNull TextComponent
text(@NotNull java.util.function.Consumer<? super TextComponent.Builder> consumer)
Creates a text component by applying configuration fromconsumer
.static @NotNull TextComponent
textOfChildren(@NotNull ComponentLike @NotNull ... components)
Creates a text component withcomponents
as the children.static @NotNull java.util.stream.Collector<Component,? extends ComponentBuilder<?,?>,Component>
toComponent()
Create a collector that will join components without a separator.static @NotNull java.util.stream.Collector<Component,? extends ComponentBuilder<?,?>,Component>
toComponent(@NotNull Component separator)
Create a collector that will join components using the provided separator.static @NotNull TranslatableComponent.Builder
translatable()
Creates a translatable component builder.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key)
Creates a translatable component with a translation key.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key and arguments.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key and arguments.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @NotNull Style style)
Creates a translatable component with a translation key and styling.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @NotNull Style style, @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key and styling.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @NotNull Style style, @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key and styling.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable java.lang.String fallback)
Creates a translatable component with a translation key and an optional fallback string.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable java.lang.String fallback, @NotNull java.util.List<? extends ComponentLike> args, @NotNull java.lang.Iterable<StyleBuilderApplicable> style)
Creates a translatable component with a translation key, optional fallback string, and arguments.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable java.lang.String fallback, @NotNull java.util.List<? extends ComponentLike> args, @NotNull StyleBuilderApplicable... style)
Creates a translatable component with a translation key, optional fallback string, and arguments.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable java.lang.String fallback, @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, optional fallback string, and arguments.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable java.lang.String fallback, @NotNull Style style)
Creates a translatable component with a translation key, optional fallback string, and styling.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable java.lang.String fallback, @NotNull StyleBuilderApplicable... style)
Creates a translatable component with a translation key, optional fallback string, and styling.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable java.lang.String fallback, @NotNull Style style, @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key, optional fallback string, and arguments.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable java.lang.String fallback, @NotNull Style style, @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, optional fallback string, and styling.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable TextColor color)
Creates a translatable component with a translation key, and optional color.static TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable TextColor color, @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key, arguments, and optional color.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations)
Creates a translatable component with a translation key, and optional color and decorations.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations, @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key, arguments, and optional color and decorations.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations, @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, arguments, and optional color and decorations.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable TextColor color, @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, arguments, and optional color.static @NotNull TranslatableComponent
translatable(@NotNull java.lang.String key, @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a translatable component with a translation key, and optional color and decorations.static @NotNull TranslatableComponent
translatable(@NotNull java.util.function.Consumer<? super TranslatableComponent.Builder> consumer)
Creates a translatable component by applying configuration fromconsumer
.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable)
Creates a translatable component with a translation key.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key and arguments.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key and arguments.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @NotNull Style style)
Creates a translatable component with a translation key and styling.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @NotNull Style style, @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key and styling.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @NotNull Style style, @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key and styling.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable java.lang.String fallback)
Creates a translatable component with a translation key and an optional fallback string.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable java.lang.String fallback, @NotNull java.lang.Iterable<StyleBuilderApplicable> style)
Creates a translatable component with a translation key, optional fallback string, and styling.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable java.lang.String fallback, @NotNull java.util.List<? extends ComponentLike> args, @NotNull java.lang.Iterable<StyleBuilderApplicable> style)
Creates a translatable component with a translation key, optional fallback string, and arguments.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable java.lang.String fallback, @NotNull java.util.List<? extends ComponentLike> args, @NotNull StyleBuilderApplicable... style)
Creates a translatable component with a translation key, optional fallback string, and arguments.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable java.lang.String fallback, @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, optional fallback string, and arguments.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable java.lang.String fallback, @NotNull Style style)
Creates a translatable component with a translation key, optional fallback string, and styling.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable java.lang.String fallback, @NotNull Style style, @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key, optional fallback string, and arguments.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable java.lang.String fallback, @NotNull Style style, @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, optional fallback string, and styling.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable TextColor color)
Creates a translatable component with a translation key, and optional color.static TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable TextColor color, @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key, arguments, and optional color.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations)
Creates a translatable component with a translation key, and optional color and decorations.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations, @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key, arguments, and optional color and decorations.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable TextColor color, @NotNull java.util.Set<TextDecoration> decorations, @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, arguments, and optional color and decorations.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable TextColor color, @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, arguments, and optional color.static @NotNull TranslatableComponent
translatable(@NotNull Translatable translatable, @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a translatable component with a translation key, and optional color and decorations.-
Methods inherited from interface net.kyori.adventure.text.event.HoverEventSource
asHoverEvent
-
Methods inherited from interface net.kyori.adventure.text.format.StyleSetter
decorate, decorations
-
-
-
-
Field Detail
-
EQUALS
static final java.util.function.BiPredicate<? super Component,? super Component> EQUALS
A predicate that checks equality of twoComponent
s usingObjects.equals(Object, Object)
.- Since:
- 4.8.0
-
EQUALS_IDENTITY
static final java.util.function.BiPredicate<? super Component,? super Component> EQUALS_IDENTITY
A predicate that checks equality of twoComponent
s using identity equality.- Since:
- 4.8.0
-
-
Method Detail
-
empty
@NotNull static @NotNull TextComponent empty()
Gets an empty component.- Returns:
- an empty component
- Since:
- 4.0.0
-
newline
@NotNull static @NotNull TextComponent newline()
Gets a text component with a new line character as the content.- Returns:
- a text component with a new line character as the content
- Since:
- 4.0.0
-
space
@NotNull static @NotNull TextComponent space()
Gets a text immutable component with a single space as the content.- Returns:
- a text component with a single space as the content
- Since:
- 4.0.0
-
join
@ScheduledForRemoval(inVersion="5.0.0") @Deprecated @Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent join(@NotNull @NotNull ComponentLike separator, @NotNull @NotNull ComponentLike @NotNull ... components)
Deprecated.for removal since 4.9.0, usejoin(JoinConfiguration, ComponentLike...)
withJoinConfiguration.separator(ComponentLike)
instead.Joinscomponents
usingseparator
.- Parameters:
separator
- the separatorcomponents
- the components- Returns:
- a text component
- Since:
- 4.0.0
-
join
@ScheduledForRemoval(inVersion="5.0.0") @Deprecated @Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent join(@NotNull @NotNull ComponentLike separator, java.lang.Iterable<? extends ComponentLike> components)
Deprecated.for removal since 4.9.0, usejoin(JoinConfiguration, Iterable)
withJoinConfiguration.separator(ComponentLike)
instead.Joinscomponents
usingseparator
.- Parameters:
separator
- the separatorcomponents
- the components- Returns:
- a text component
- Since:
- 4.0.0
-
join
@Contract(pure=true) @NotNull static @NotNull Component join(@NotNull JoinConfiguration.Builder configBuilder, @NotNull @NotNull ComponentLike @NotNull ... components)
Joinscomponents
using the configuration inconfigBuilder
.- Parameters:
configBuilder
- the join configurationcomponents
- the components- Returns:
- the resulting component
- Since:
- 4.14.0
- See Also:
JoinConfiguration.noSeparators()
,JoinConfiguration.separator(ComponentLike)
,JoinConfiguration.separators(ComponentLike, ComponentLike)
-
join
@Contract(pure=true) @NotNull static @NotNull Component join(@NotNull JoinConfiguration.Builder configBuilder, @NotNull @NotNull java.lang.Iterable<? extends ComponentLike> components)
Joinscomponents
using the configuration inconfigBuilder
.- Parameters:
configBuilder
- the join configurationcomponents
- the components- Returns:
- the resulting component
- Since:
- 4.14.0
- See Also:
JoinConfiguration.noSeparators()
,JoinConfiguration.separator(ComponentLike)
,JoinConfiguration.separators(ComponentLike, ComponentLike)
-
join
@Contract(pure=true) @NotNull static @NotNull Component join(@NotNull @NotNull JoinConfiguration config, @NotNull @NotNull ComponentLike @NotNull ... components)
Joinscomponents
using the configuration inconfig
.- Parameters:
config
- the join configurationcomponents
- the components- Returns:
- the resulting component
- Since:
- 4.9.0
- See Also:
JoinConfiguration.noSeparators()
,JoinConfiguration.separator(ComponentLike)
,JoinConfiguration.separators(ComponentLike, ComponentLike)
-
join
@Contract(pure=true) @NotNull static @NotNull Component join(@NotNull @NotNull JoinConfiguration config, @NotNull @NotNull java.lang.Iterable<? extends ComponentLike> components)
Joinscomponents
using the configuration inconfig
.- Parameters:
config
- the join configurationcomponents
- the components- Returns:
- the resulting component
- Since:
- 4.9.0
- See Also:
JoinConfiguration.noSeparators()
,JoinConfiguration.separator(ComponentLike)
,JoinConfiguration.separators(ComponentLike, ComponentLike)
-
toComponent
@NotNull static @NotNull java.util.stream.Collector<Component,? extends ComponentBuilder<?,?>,Component> toComponent()
Create a collector that will join components without a separator.- Returns:
- a collector that can join components
- Since:
- 4.6.0
-
toComponent
@NotNull static @NotNull java.util.stream.Collector<Component,? extends ComponentBuilder<?,?>,Component> toComponent(@NotNull @NotNull Component separator)
Create a collector that will join components using the provided separator.- Parameters:
separator
- the separator to join with- Returns:
- a collector that can join components
- Since:
- 4.6.0
-
blockNBT
@Contract(pure=true) static @NotNull BlockNBTComponent.Builder blockNBT()
Creates a block NBT component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
blockNBT
@Contract("_ -> new") @NotNull static @NotNull BlockNBTComponent blockNBT(@NotNull @NotNull java.util.function.Consumer<? super BlockNBTComponent.Builder> consumer)
Creates a block NBT component by applying configuration fromconsumer
.- Parameters:
consumer
- the builder configurator- Returns:
- a block NBT component
- Since:
- 4.0.0
-
blockNBT
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull BlockNBTComponent blockNBT(@NotNull @NotNull java.lang.String nbtPath, @NotNull BlockNBTComponent.Pos pos)
Creates a block NBT component with a position.- Parameters:
nbtPath
- the nbt pathpos
- the block position- Returns:
- a block NBT component
- Since:
- 4.0.0
-
blockNBT
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull BlockNBTComponent blockNBT(@NotNull @NotNull java.lang.String nbtPath, boolean interpret, @NotNull BlockNBTComponent.Pos pos)
Creates a block NBT component with a position.- Parameters:
nbtPath
- the nbt pathinterpret
- whether to interpretpos
- the block position- Returns:
- a block NBT component
- Since:
- 4.0.0
-
blockNBT
@Contract(value="_, _, _, _ -> new", pure=true) @NotNull static @NotNull BlockNBTComponent blockNBT(@NotNull @NotNull java.lang.String nbtPath, boolean interpret, @Nullable @Nullable ComponentLike separator, @NotNull BlockNBTComponent.Pos pos)
Creates a block NBT component with a position.- Parameters:
nbtPath
- the nbt pathinterpret
- whether to interpretseparator
- the separatorpos
- the block position- Returns:
- a block NBT component
- Since:
- 4.8.0
-
entityNBT
@Contract(pure=true) static @NotNull EntityNBTComponent.Builder entityNBT()
Creates an entity NBT component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
entityNBT
@Contract("_ -> new") @NotNull static @NotNull EntityNBTComponent entityNBT(@NotNull @NotNull java.util.function.Consumer<? super EntityNBTComponent.Builder> consumer)
Creates a entity NBT component by applying configuration fromconsumer
.- Parameters:
consumer
- the builder configurator- Returns:
- an entity NBT component
- Since:
- 4.0.0
-
entityNBT
@Contract("_, _ -> new") @NotNull static @NotNull EntityNBTComponent entityNBT(@NotNull @NotNull java.lang.String nbtPath, @NotNull @NotNull java.lang.String selector)
Creates a entity NBT component with a position.- Parameters:
nbtPath
- the nbt pathselector
- the selector- Returns:
- an entity NBT component
- Since:
- 4.0.0
-
keybind
@Contract(pure=true) static @NotNull KeybindComponent.Builder keybind()
Creates a keybind component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
keybind
@Contract("_ -> new") @NotNull static @NotNull KeybindComponent keybind(@NotNull @NotNull java.util.function.Consumer<? super KeybindComponent.Builder> consumer)
Creates a keybind component by applying configuration fromconsumer
.- Parameters:
consumer
- the builder configurator- Returns:
- the keybind component
- Since:
- 4.0.0
-
keybind
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull KeybindComponent keybind(@NotNull @NotNull java.lang.String keybind)
Creates a keybind component with a keybind.- Parameters:
keybind
- the keybind- Returns:
- the keybind component
- Since:
- 4.0.0
-
keybind
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull KeybindComponent keybind(@NotNull KeybindComponent.KeybindLike keybind)
Creates a keybind component with a keybind.- Parameters:
keybind
- the keybind- Returns:
- the keybind component
- Since:
- 4.9.0
-
keybind
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull KeybindComponent keybind(@NotNull @NotNull java.lang.String keybind, @NotNull @NotNull Style style)
Creates a keybind component with a keybind and styling.- Parameters:
keybind
- the keybindstyle
- the style- Returns:
- the keybind component
- Since:
- 4.0.0
-
keybind
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull KeybindComponent keybind(@NotNull KeybindComponent.KeybindLike keybind, @NotNull @NotNull Style style)
Creates a keybind component with a keybind and styling.- Parameters:
keybind
- the keybindstyle
- the style- Returns:
- the keybind component
- Since:
- 4.9.0
-
keybind
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull KeybindComponent keybind(@NotNull @NotNull java.lang.String keybind, @Nullable @Nullable TextColor color)
Creates a keybind component with a keybind, and optional color.- Parameters:
keybind
- the keybindcolor
- the color- Returns:
- the keybind component
- Since:
- 4.0.0
-
keybind
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull KeybindComponent keybind(@NotNull KeybindComponent.KeybindLike keybind, @Nullable @Nullable TextColor color)
Creates a keybind component with a keybind, and optional color.- Parameters:
keybind
- the keybindcolor
- the color- Returns:
- the keybind component
- Since:
- 4.9.0
-
keybind
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull KeybindComponent keybind(@NotNull @NotNull java.lang.String keybind, @Nullable @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a keybind component with a keybind, and optional color and decorations.- Parameters:
keybind
- the keybindcolor
- the colordecorations
- the decorations- Returns:
- the keybind component
- Since:
- 4.0.0
-
keybind
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull KeybindComponent keybind(@NotNull KeybindComponent.KeybindLike keybind, @Nullable @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a keybind component with a keybind, and optional color and decorations.- Parameters:
keybind
- the keybindcolor
- the colordecorations
- the decorations- Returns:
- the keybind component
- Since:
- 4.9.0
-
keybind
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull KeybindComponent keybind(@NotNull @NotNull java.lang.String keybind, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations)
Creates a keybind component with a keybind, and optional color and decorations.- Parameters:
keybind
- the keybindcolor
- the colordecorations
- the decorations- Returns:
- the keybind component
- Since:
- 4.0.0
-
keybind
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull KeybindComponent keybind(@NotNull KeybindComponent.KeybindLike keybind, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations)
Creates a keybind component with a keybind, and optional color and decorations.- Parameters:
keybind
- the keybindcolor
- the colordecorations
- the decorations- Returns:
- the keybind component
- Since:
- 4.9.0
-
score
@Contract(pure=true) static @NotNull ScoreComponent.Builder score()
Creates a score component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
score
@Contract("_ -> new") @NotNull static @NotNull ScoreComponent score(@NotNull @NotNull java.util.function.Consumer<? super ScoreComponent.Builder> consumer)
Creates a score component by applying configuration fromconsumer
.- Parameters:
consumer
- the builder configurator- Returns:
- a score component
- Since:
- 4.0.0
-
score
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull ScoreComponent score(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String objective)
Creates a score component with a name and objective.- Parameters:
name
- the score nameobjective
- the score objective- Returns:
- a score component
- Since:
- 4.0.0
-
score
@Contract(value="_, _, _ -> new", pure=true) @Deprecated @NotNull static @NotNull ScoreComponent score(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String objective, @Nullable @Nullable java.lang.String value)
Deprecated.since 4.7.0, not for removal, with no replacement. Thevalue
field is no longer supported in 1.16.5.Creates a score component with a name, objective, and optional value.- Parameters:
name
- the score nameobjective
- the score objectivevalue
- the value- Returns:
- a score component
- Since:
- 4.0.0
-
selector
@Contract(pure=true) static @NotNull SelectorComponent.Builder selector()
Creates a selector component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
selector
@Contract("_ -> new") @NotNull static @NotNull SelectorComponent selector(@NotNull @NotNull java.util.function.Consumer<? super SelectorComponent.Builder> consumer)
Creates a selector component by applying configuration fromconsumer
.- Parameters:
consumer
- the builder configurator- Returns:
- a selector component
- Since:
- 4.0.0
-
selector
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull SelectorComponent selector(@NotNull @NotNull java.lang.String pattern)
Creates a selector component with a pattern.- Parameters:
pattern
- the selector pattern- Returns:
- a selector component
- Since:
- 4.0.0
-
selector
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull SelectorComponent selector(@NotNull @NotNull java.lang.String pattern, @Nullable @Nullable ComponentLike separator)
Creates a selector component with a pattern.- Parameters:
pattern
- the selector patternseparator
- the separator- Returns:
- a selector component
- Since:
- 4.8.0
-
storageNBT
@Contract(pure=true) static @NotNull StorageNBTComponent.Builder storageNBT()
Creates an storage NBT component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
storageNBT
@Contract("_ -> new") @NotNull static @NotNull StorageNBTComponent storageNBT(@NotNull @NotNull java.util.function.Consumer<? super StorageNBTComponent.Builder> consumer)
Creates a storage NBT component by applying configuration fromconsumer
.- Parameters:
consumer
- the builder configurator- Returns:
- a storage NBT component
- Since:
- 4.0.0
-
storageNBT
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull StorageNBTComponent storageNBT(@NotNull @NotNull java.lang.String nbtPath, @NotNull @NotNull Key storage)
Creates a storage NBT component with a path and an storage ID.- Parameters:
nbtPath
- the nbt pathstorage
- the identifier of the storage- Returns:
- a storage NBT component
- Since:
- 4.0.0
-
storageNBT
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull StorageNBTComponent storageNBT(@NotNull @NotNull java.lang.String nbtPath, boolean interpret, @NotNull @NotNull Key storage)
Creates a storage NBT component with a path and an storage ID.- Parameters:
nbtPath
- the nbt pathinterpret
- whether to interpretstorage
- the identifier of the storage- Returns:
- a storage NBT component
- Since:
- 4.0.0
-
storageNBT
@Contract(value="_, _, _, _ -> new", pure=true) @NotNull static @NotNull StorageNBTComponent storageNBT(@NotNull @NotNull java.lang.String nbtPath, boolean interpret, @Nullable @Nullable ComponentLike separator, @NotNull @NotNull Key storage)
Creates a storage NBT component with a path and an storage ID.- Parameters:
nbtPath
- the nbt pathinterpret
- whether to interpretseparator
- the separatorstorage
- the identifier of the storage- Returns:
- a storage NBT component
- Since:
- 4.8.0
-
text
@Contract(pure=true) static @NotNull TextComponent.Builder text()
Creates a text component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
textOfChildren
@NotNull static @NotNull TextComponent textOfChildren(@NotNull @NotNull ComponentLike @NotNull ... components)
Creates a text component withcomponents
as the children.- Parameters:
components
- the children- Returns:
- a text component
- Since:
- 4.10.0
-
text
@Contract("_ -> new") @NotNull static @NotNull TextComponent text(@NotNull @NotNull java.util.function.Consumer<? super TextComponent.Builder> consumer)
Creates a text component by applying configuration fromconsumer
.- Parameters:
consumer
- the builder configurator- Returns:
- the text component
- Since:
- 4.0.0
-
text
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull TextComponent text(@NotNull @NotNull java.lang.String content)
Creates a text component with content.- Parameters:
content
- the plain text content- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(@NotNull @NotNull java.lang.String content, @NotNull @NotNull Style style)
Creates a text component with content and styling.- Parameters:
content
- the plain text contentstyle
- the style- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(@NotNull @NotNull java.lang.String content, @Nullable @Nullable TextColor color)
Creates a text component with content, and optional color.- Parameters:
content
- the plain text contentcolor
- the color- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(@NotNull @NotNull java.lang.String content, @Nullable @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a text component with content, and optional color and decorations.- Parameters:
content
- the plain text contentcolor
- the colordecorations
- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(@NotNull @NotNull java.lang.String content, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations)
Creates a text component with content, and optional color and decorations.- Parameters:
content
- the plain text contentcolor
- the colordecorations
- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull TextComponent text(boolean value)
Creates a text component with the content ofString.valueOf(boolean)
.- Parameters:
value
- the boolean value- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(boolean value, @NotNull @NotNull Style style)
Creates a text component with the content ofString.valueOf(boolean)
and styling.- Parameters:
value
- the boolean valuestyle
- the style- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(boolean value, @Nullable @Nullable TextColor color)
Creates a text component with the content ofString.valueOf(boolean)
, and optional color.- Parameters:
value
- the boolean valuecolor
- the color- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(boolean value, @Nullable @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a text component with the content ofString.valueOf(boolean)
, and optional color and decorations.- Parameters:
value
- the boolean valuecolor
- the colordecorations
- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(boolean value, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations)
Creates a text component with the content ofString.valueOf(boolean)
, and optional color and decorations.- Parameters:
value
- the boolean valuecolor
- the colordecorations
- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(pure=true) @NotNull static @NotNull TextComponent text(char value)
Creates a text component with the content ofString.valueOf(char)
.- Parameters:
value
- the char value- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(char value, @NotNull @NotNull Style style)
Creates a text component with the content ofString.valueOf(char)
and styling.- Parameters:
value
- the char valuestyle
- the style- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(char value, @Nullable @Nullable TextColor color)
Creates a text component with the content ofString.valueOf(char)
, and optional color.- Parameters:
value
- the char valuecolor
- the color- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(char value, @Nullable @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a text component with the content ofString.valueOf(char)
, and optional color and decorations.- Parameters:
value
- the char valuecolor
- the colordecorations
- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(char value, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations)
Creates a text component with the content ofString.valueOf(char)
, and optional color and decorations.- Parameters:
value
- the char valuecolor
- the colordecorations
- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull TextComponent text(double value)
Creates a text component with the content ofString.valueOf(double)
.- Parameters:
value
- the double value- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(double value, @NotNull @NotNull Style style)
Creates a text component with the content ofString.valueOf(double)
and styling.- Parameters:
value
- the double valuestyle
- the style- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(double value, @Nullable @Nullable TextColor color)
Creates a text component with the content ofString.valueOf(double)
, and optional color.- Parameters:
value
- the double valuecolor
- the color- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(double value, @Nullable @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a text component with the content ofString.valueOf(double)
, and optional color and decorations.- Parameters:
value
- the double valuecolor
- the colordecorations
- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(double value, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations)
Creates a text component with the content ofString.valueOf(double)
, and optional color and decorations.- Parameters:
value
- the double valuecolor
- the colordecorations
- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull TextComponent text(float value)
Creates a text component with the content ofString.valueOf(float)
.- Parameters:
value
- the float value- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(float value, @NotNull @NotNull Style style)
Creates a text component with the content ofString.valueOf(float)
and styling.- Parameters:
value
- the float valuestyle
- the style- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(float value, @Nullable @Nullable TextColor color)
Creates a text component with the content ofString.valueOf(float)
, and optional color.- Parameters:
value
- the float valuecolor
- the color- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(float value, @Nullable @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a text component with the content ofString.valueOf(float)
, and optional color and decorations.- Parameters:
value
- the float valuecolor
- the colordecorations
- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(float value, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations)
Creates a text component with the content ofString.valueOf(float)
, and optional color and decorations.- Parameters:
value
- the float valuecolor
- the colordecorations
- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull TextComponent text(int value)
Creates a text component with the content ofString.valueOf(int)
.- Parameters:
value
- the int value- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(int value, @NotNull @NotNull Style style)
Creates a text component with the content ofString.valueOf(int)
and styling.- Parameters:
value
- the int valuestyle
- the style- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(int value, @Nullable @Nullable TextColor color)
Creates a text component with the content ofString.valueOf(int)
, and optional color.- Parameters:
value
- the int valuecolor
- the color- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(int value, @Nullable @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a text component with the content ofString.valueOf(int)
, and optional color and decorations.- Parameters:
value
- the int valuecolor
- the colordecorations
- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(int value, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations)
Creates a text component with the content ofString.valueOf(int)
, and optional color and decorations.- Parameters:
value
- the int valuecolor
- the colordecorations
- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull TextComponent text(long value)
Creates a text component with the content ofString.valueOf(long)
.- Parameters:
value
- the long value- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(long value, @NotNull @NotNull Style style)
Creates a text component with the content ofString.valueOf(long)
and styling.- Parameters:
value
- the long valuestyle
- the style- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(long value, @Nullable @Nullable TextColor color)
Creates a text component with the content ofString.valueOf(long)
, and optional color.- Parameters:
value
- the long valuecolor
- the color- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(long value, @Nullable @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a text component with the content ofString.valueOf(long)
, and optional color and decorations.- Parameters:
value
- the long valuecolor
- the colordecorations
- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TextComponent text(long value, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations)
Creates a text component with the content ofString.valueOf(long)
, and optional color and decorations.- Parameters:
value
- the long valuecolor
- the colordecorations
- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
translatable
@Contract(pure=true) static @NotNull TranslatableComponent.Builder translatable()
Creates a translatable component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
translatable
@Contract("_ -> new") @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.util.function.Consumer<? super TranslatableComponent.Builder> consumer)
Creates a translatable component by applying configuration fromconsumer
.- Parameters:
consumer
- the builder configurator- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key)
Creates a translatable component with a translation key.- Parameters:
key
- the translation key- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable)
Creates a translatable component with a translation key.- Parameters:
translatable
- the translatable object to get the key from- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable java.lang.String fallback)
Creates a translatable component with a translation key and an optional fallback string.- Parameters:
key
- the translation keyfallback
- the fallback string- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable java.lang.String fallback)
Creates a translatable component with a translation key and an optional fallback string.- Parameters:
translatable
- the translatable object to get the key fromfallback
- the fallback string- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @NotNull @NotNull Style style)
Creates a translatable component with a translation key and styling.- Parameters:
key
- the translation keystyle
- the style- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @NotNull @NotNull Style style)
Creates a translatable component with a translation key and styling.- Parameters:
translatable
- the translatable object to get the key fromstyle
- the style- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable java.lang.String fallback, @NotNull @NotNull Style style)
Creates a translatable component with a translation key, optional fallback string, and styling.- Parameters:
key
- the translation keyfallback
- the fallback stringstyle
- the style- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable java.lang.String fallback, @NotNull @NotNull Style style)
Creates a translatable component with a translation key, optional fallback string, and styling.- Parameters:
translatable
- the translatable object to get the key fromfallback
- the fallback stringstyle
- the style- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable java.lang.String fallback, @NotNull @NotNull StyleBuilderApplicable... style)
Creates a translatable component with a translation key, optional fallback string, and styling.- Parameters:
key
- the translation keyfallback
- the fallback stringstyle
- the style- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable java.lang.String fallback, @NotNull @NotNull java.lang.Iterable<StyleBuilderApplicable> style)
Creates a translatable component with a translation key, optional fallback string, and styling.- Parameters:
translatable
- the translatable object to get the key fromfallback
- the fallback stringstyle
- the style- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable java.lang.String fallback, @NotNull @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
key
- the translation keyfallback
- the fallback stringargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable java.lang.String fallback, @NotNull @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
translatable
- the translatable object to get the key fromfallback
- the fallback stringargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable java.lang.String fallback, @NotNull @NotNull Style style, @NotNull @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, optional fallback string, and styling.- Parameters:
key
- the translation keyfallback
- the fallback stringstyle
- the styleargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable java.lang.String fallback, @NotNull @NotNull Style style, @NotNull @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, optional fallback string, and styling.- Parameters:
translatable
- the translatable object to get the key fromfallback
- the fallback stringstyle
- the styleargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable java.lang.String fallback, @NotNull @NotNull Style style, @NotNull @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
key
- the translation keyfallback
- the fallback stringstyle
- the styleargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable java.lang.String fallback, @NotNull @NotNull Style style, @NotNull @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
translatable
- the translatable object to get the key fromfallback
- the fallback stringstyle
- the styleargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable java.lang.String fallback, @NotNull @NotNull java.util.List<? extends ComponentLike> args, @NotNull @NotNull java.lang.Iterable<StyleBuilderApplicable> style)
Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
key
- the translation keyfallback
- the fallback stringargs
- the translation argumentsstyle
- the style- Returns:
- a translatable component
- Since:
- 4.0.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable java.lang.String fallback, @NotNull @NotNull java.util.List<? extends ComponentLike> args, @NotNull @NotNull java.lang.Iterable<StyleBuilderApplicable> style)
Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
translatable
- the translatable object to get the key fromfallback
- the fallback stringargs
- the translation argumentsstyle
- the style- Returns:
- a translatable component
- Since:
- 4.8.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable java.lang.String fallback, @NotNull @NotNull java.util.List<? extends ComponentLike> args, @NotNull @NotNull StyleBuilderApplicable... style)
Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
key
- the translation keyfallback
- the fallback stringargs
- the translation argumentsstyle
- the style- Returns:
- a translatable component
- Since:
- 4.0.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable java.lang.String fallback, @NotNull @NotNull java.util.List<? extends ComponentLike> args, @NotNull @NotNull StyleBuilderApplicable... style)
Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
translatable
- the translatable object to get the key fromfallback
- the fallback stringargs
- the translation argumentsstyle
- the style- Returns:
- a translatable component
- Since:
- 4.8.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable TextColor color)
Creates a translatable component with a translation key, and optional color.- Parameters:
key
- the translation keycolor
- the color- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable TextColor color)
Creates a translatable component with a translation key, and optional color.- Parameters:
translatable
- the translatable object to get the key fromcolor
- the color- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a translatable component with a translation key, and optional color and decorations.- Parameters:
key
- the translation keycolor
- the colordecorations
- the decorations- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable TextColor color, TextDecoration @NotNull ... decorations)
Creates a translatable component with a translation key, and optional color and decorations.- Parameters:
translatable
- the translatable object to get the key fromcolor
- the colordecorations
- the decorations- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations)
Creates a translatable component with a translation key, and optional color and decorations.- Parameters:
key
- the translation keycolor
- the colordecorations
- the decorations- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations)
Creates a translatable component with a translation key, and optional color and decorations.- Parameters:
translatable
- the translatable object to get the key fromcolor
- the colordecorations
- the decorations- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @NotNull @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key and arguments.- Parameters:
key
- the translation keyargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @NotNull @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key and arguments.- Parameters:
translatable
- the translatable object to get the key fromargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @NotNull @NotNull Style style, @NotNull @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key and styling.- Parameters:
key
- the translation keystyle
- the styleargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @NotNull @NotNull Style style, @NotNull @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key and styling.- Parameters:
translatable
- the translatable object to get the key fromstyle
- the styleargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable TextColor color, @NotNull @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, arguments, and optional color.- Parameters:
key
- the translation keycolor
- the colorargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable TextColor color, @NotNull @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, arguments, and optional color.- Parameters:
translatable
- the translatable object to get the key fromcolor
- the colorargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations, @NotNull @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, arguments, and optional color and decorations.- Parameters:
key
- the translation keycolor
- the colordecorations
- the decorationsargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations, @NotNull @NotNull ComponentLike @NotNull ... args)
Creates a translatable component with a translation key, arguments, and optional color and decorations.- Parameters:
translatable
- the translatable object to get the key fromcolor
- the colordecorations
- the decorationsargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key and arguments.- Parameters:
key
- the translation keyargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @NotNull @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key and arguments.- Parameters:
translatable
- the translatable object to get the key fromargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @NotNull @NotNull Style style, @NotNull @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key and styling.- Parameters:
key
- the translation keystyle
- the styleargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @NotNull @NotNull Style style, @NotNull @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key and styling.- Parameters:
translatable
- the translatable object to get the key fromstyle
- the styleargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key, arguments, and optional color.- Parameters:
key
- the translation keycolor
- the colorargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key, arguments, and optional color.- Parameters:
translatable
- the translatable object to get the key fromcolor
- the colorargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull java.lang.String key, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations, @NotNull @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key, arguments, and optional color and decorations.- Parameters:
key
- the translation keycolor
- the colordecorations
- the decorationsargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) @NotNull static @NotNull TranslatableComponent translatable(@NotNull @NotNull Translatable translatable, @Nullable @Nullable TextColor color, @NotNull @NotNull java.util.Set<TextDecoration> decorations, @NotNull @NotNull java.util.List<? extends ComponentLike> args)
Creates a translatable component with a translation key, arguments, and optional color and decorations.- Parameters:
translatable
- the translatable object to get the key fromcolor
- the colordecorations
- the decorationsargs
- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
children
@NotNull @Unmodifiable @NotNull java.util.List<Component> children()
Gets the unmodifiable list of children.- Returns:
- the unmodifiable list of children
- Since:
- 4.0.0
-
children
@Contract(pure=true) @NotNull @NotNull Component children(@NotNull @NotNull java.util.List<? extends ComponentLike> children)
Sets the list of children.The contents of
children
will be copied.- Parameters:
children
- the children- Returns:
- a component with the children set
- Since:
- 4.0.0
-
contains
default boolean contains(@NotNull @NotNull Component that)
Checks if this component contains a component.This method uses identity comparison when checking for contains. Use
contains(Component, BiPredicate)
withEQUALS
if you wish to use full equality comparison.- Parameters:
that
- the other component- Returns:
true
if this component contains the provided component,false
otherwise- Since:
- 4.0.0
-
contains
default boolean contains(@NotNull @NotNull Component that, @NotNull @NotNull java.util.function.BiPredicate<? super Component,? super Component> equals)
Checks if this component contains a component.- Parameters:
that
- the other componentequals
- the equality tester- Returns:
true
if this component contains the provided component,false
otherwise- Since:
- 4.8.0
-
detectCycle
@ScheduledForRemoval(inVersion="5.0.0") @Deprecated default void detectCycle(@NotNull @NotNull Component that)
Deprecated.for removal since 4.7.0, with no replacement - this method is not necessary due to the factComponent
s are immutablePrevents a cycle between this component and the provided component.- Parameters:
that
- the other component- Since:
- 4.0.0
-
append
@Contract(pure=true) @NotNull default @NotNull Component append(@NotNull @NotNull Component component)
Appends a component to this component.- Parameters:
component
- the component to append- Returns:
- a component with the component added
- Since:
- 4.0.0
-
append
@NotNull default @NotNull Component append(@NotNull @NotNull ComponentLike like)
Appends a component to this component.- Parameters:
like
- the component to append- Returns:
- a component with the component added
- Since:
- 4.0.0
-
append
@Contract(pure=true) @NotNull default @NotNull Component append(@NotNull @NotNull ComponentBuilder<?,?> builder)
Appends a component to this component.- Parameters:
builder
- the component to append- Returns:
- a component with the component added
- Since:
- 4.0.0
-
appendNewline
@Contract(pure=true) @NotNull default @NotNull Component appendNewline()
Appends a newline to this component.- Returns:
- a component with the newline added
- Since:
- 4.12.0
-
appendSpace
@Contract(pure=true) @NotNull default @NotNull Component appendSpace()
Appends a space to this component.- Returns:
- a component with the space added
- Since:
- 4.12.0
-
applyFallbackStyle
@Contract(pure=true) @NotNull default @NotNull Component applyFallbackStyle(@NotNull @NotNull Style style)
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.
- Parameters:
style
- style to be used as a fallback- Returns:
- the styled component
- Since:
- 4.10.0
-
applyFallbackStyle
@Contract(pure=true) @NotNull default @NotNull Component applyFallbackStyle(@NotNull @NotNull StyleBuilderApplicable @NotNull ... style)
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.
- Parameters:
style
- style to be used as a fallback- Returns:
- the styled component
- Since:
- 4.10.0
-
style
@NotNull @NotNull Style style()
Gets the style of this component.- Returns:
- the style of this component
- Since:
- 4.0.0
-
style
@Contract(pure=true) @NotNull @NotNull Component style(@NotNull @NotNull Style style)
Sets the style of this component.- Parameters:
style
- the style- Returns:
- a component
- Since:
- 4.0.0
-
style
@Contract(pure=true) @NotNull default @NotNull Component style(@NotNull @NotNull java.util.function.Consumer<Style.Builder> consumer)
Sets the style of this component.- Parameters:
consumer
- the style consumer- Returns:
- a component
- Since:
- 4.0.0
-
style
@Contract(pure=true) @NotNull default @NotNull Component style(@NotNull @NotNull java.util.function.Consumer<Style.Builder> consumer, @NotNull Style.Merge.Strategy strategy)
Sets the style of this component.- Parameters:
consumer
- the style consumerstrategy
- the merge strategy- Returns:
- a component
- Since:
- 4.0.0
-
style
@Contract(pure=true) @NotNull default @NotNull Component style(@NotNull Style.Builder style)
Sets the style of this component.- Parameters:
style
- the style- Returns:
- a component
- Since:
- 4.0.0
-
mergeStyle
@Contract(pure=true) @NotNull default @NotNull Component mergeStyle(@NotNull @NotNull Component that)
Merges from another style into this component's style.- Parameters:
that
- the other style- Returns:
- a component
- Since:
- 4.0.0
-
mergeStyle
@Contract(pure=true) @NotNull default @NotNull Component mergeStyle(@NotNull @NotNull Component that, @NotNull Style.Merge @NotNull ... merges)
Merges from another style into this component's style.- Parameters:
that
- the other stylemerges
- the style parts to merge- Returns:
- a component
- Since:
- 4.0.0
-
mergeStyle
@Contract(pure=true) @NotNull default @NotNull Component mergeStyle(@NotNull @NotNull Component that, @NotNull @NotNull java.util.Set<Style.Merge> merges)
Merges from another style into this component's style.- Parameters:
that
- the other stylemerges
- the style parts to merge- Returns:
- a component
- Since:
- 4.0.0
-
font
@Nullable default @Nullable Key font()
Gets the font.- Specified by:
font
in interfaceStyleGetter
- Returns:
- the font of this component
- Since:
- 4.10.0
-
font
@NotNull default @NotNull Component font(@Nullable @Nullable Key key)
Sets the font.- Specified by:
font
in interfaceStyleSetter<Component>
- Parameters:
key
- a font- Returns:
- a component
- Since:
- 4.10.0
-
color
@Nullable default @Nullable TextColor color()
Gets the color of this component.- Specified by:
color
in interfaceStyleGetter
- Returns:
- the color of this component
- Since:
- 4.0.0
-
color
@Contract(pure=true) @NotNull default @NotNull Component color(@Nullable @Nullable TextColor color)
Sets the color of this component.- Specified by:
color
in interfaceStyleSetter<Component>
- Parameters:
color
- the color- Returns:
- a component
- Since:
- 4.0.0
-
colorIfAbsent
@Contract(pure=true) @NotNull default @NotNull Component colorIfAbsent(@Nullable @Nullable TextColor color)
Sets the color if there isn't one set already.- Specified by:
colorIfAbsent
in interfaceStyleSetter<Component>
- Parameters:
color
- the color- Returns:
- a component
- Since:
- 4.0.0
-
hasDecoration
default boolean hasDecoration(@NotNull @NotNull TextDecoration decoration)
Tests if this component has a decoration.- Specified by:
hasDecoration
in interfaceStyleGetter
- Parameters:
decoration
- the decoration- Returns:
true
if this component has the decoration,false
if this component does not have the decoration- Since:
- 4.0.0
-
decorate
@Contract(pure=true) @NotNull default @NotNull Component decorate(@NotNull @NotNull TextDecoration decoration)
Sets the state ofdecoration
toTextDecoration.State.TRUE
on this component.- Specified by:
decorate
in interfaceStyleSetter<Component>
- Parameters:
decoration
- the decoration- Returns:
- a component
- Since:
- 4.0.0
-
decoration
default @NotNull TextDecoration.State decoration(@NotNull @NotNull TextDecoration decoration)
Gets the state of a decoration on this component.- Specified by:
decoration
in interfaceStyleGetter
- Parameters:
decoration
- the decoration- Returns:
TextDecoration.State.TRUE
if this component has the decoration,TextDecoration.State.FALSE
if this component does not have the decoration, andTextDecoration.State.NOT_SET
if not set- Since:
- 4.0.0
-
decoration
@Contract(pure=true) @NotNull default @NotNull Component decoration(@NotNull @NotNull TextDecoration decoration, boolean flag)
Sets the state of a decoration on this component.- Specified by:
decoration
in interfaceStyleSetter<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
- Since:
- 4.0.0
-
decoration
@Contract(pure=true) @NotNull default @NotNull Component decoration(@NotNull @NotNull TextDecoration decoration, @NotNull TextDecoration.State state)
Sets the value of a decoration on this component.- Specified by:
decoration
in interfaceStyleSetter<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
- Since:
- 4.0.0
-
decorationIfAbsent
@NotNull default @NotNull Component decorationIfAbsent(@NotNull @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
.- Specified by:
decorationIfAbsent
in interfaceStyleSetter<Component>
- Parameters:
decoration
- the decorationstate
- the state- Returns:
- a component
- Since:
- 4.12.0
-
decorations
@NotNull default @NotNull java.util.Map<TextDecoration,TextDecoration.State> decorations()
Gets a set of decorations this component has.- Specified by:
decorations
in interfaceStyleGetter
- Returns:
- a set of decorations this component has
- Since:
- 4.0.0
-
decorations
@Contract(pure=true) @NotNull default @NotNull Component decorations(@NotNull @NotNull java.util.Map<TextDecoration,TextDecoration.State> decorations)
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 interfaceStyleSetter<Component>
- Parameters:
decorations
- a set of default values- Returns:
- a component
- Since:
- 4.0.0
-
clickEvent
@Nullable default @Nullable ClickEvent clickEvent()
Gets the click event of this component.- Specified by:
clickEvent
in interfaceStyleGetter
- Returns:
- the click event
- Since:
- 4.0.0
-
clickEvent
@Contract(pure=true) @NotNull default @NotNull Component clickEvent(@Nullable @Nullable ClickEvent event)
Sets the click event of this component.- Specified by:
clickEvent
in interfaceStyleSetter<Component>
- Parameters:
event
- the click event- Returns:
- a component
- Since:
- 4.0.0
-
hoverEvent
@Nullable default @Nullable HoverEvent<?> hoverEvent()
Gets the hover event of this component.- Specified by:
hoverEvent
in interfaceStyleGetter
- Returns:
- the hover event
- Since:
- 4.0.0
-
hoverEvent
@Contract(pure=true) @NotNull default @NotNull Component hoverEvent(@Nullable @Nullable HoverEventSource<?> source)
Sets the hover event of this component.- Specified by:
hoverEvent
in interfaceStyleSetter<Component>
- Parameters:
source
- the hover event source- Returns:
- a component
- Since:
- 4.0.0
-
insertion
@Nullable default @Nullable java.lang.String insertion()
Gets the string to be inserted when this component is shift-clicked.- Specified by:
insertion
in interfaceStyleGetter
- Returns:
- the insertion string
- Since:
- 4.0.0
-
insertion
@Contract(pure=true) @NotNull default @NotNull Component insertion(@Nullable @Nullable java.lang.String insertion)
Sets the string to be inserted when this component is shift-clicked.- Specified by:
insertion
in interfaceStyleSetter<Component>
- Parameters:
insertion
- the insertion string- Returns:
- a component
- Since:
- 4.0.0
-
hasStyling
default boolean hasStyling()
Tests if this component has any styling.- Returns:
true
if this component has any styling,false
if this component does not have any styling- Since:
- 4.0.0
-
replaceText
@Contract(pure=true) @NotNull default @NotNull Component replaceText(@NotNull @NotNull java.util.function.Consumer<TextReplacementConfig.Builder> configurer)
Finds and replaces any text with this or childComponent
s using the configured options.- Parameters:
configurer
- the configurer- Returns:
- a modified copy of this component
- Since:
- 4.2.0
-
replaceText
@Contract(pure=true) @NotNull default @NotNull Component replaceText(@NotNull @NotNull TextReplacementConfig config)
Finds and replaces any text with this or childComponent
s using the provided options.- Parameters:
config
- the replacement config- Returns:
- a modified copy of this component
- Since:
- 4.2.0
-
compact
@NotNull default @NotNull Component compact()
Create a new component with any redundant style elements or children removed.- Returns:
- the optimized component
- Since:
- 4.9.0
-
iterable
@NotNull default @NotNull java.lang.Iterable<Component> iterable(@NotNull @NotNull ComponentIteratorType type, @NotNull @NotNull ComponentIteratorFlag @Nullable ... flags)
Returns an iterable view of this component.- Parameters:
type
- the typeflags
- the flags- Returns:
- the iterable
- Since:
- 4.9.0
-
iterable
@NotNull default @NotNull java.lang.Iterable<Component> iterable(@NotNull @NotNull ComponentIteratorType type, @NotNull @NotNull java.util.Set<ComponentIteratorFlag> flags)
Returns an iterable view of this component.- Parameters:
type
- the typeflags
- the flags- Returns:
- the iterable
- Since:
- 4.9.0
-
iterator
@NotNull default @NotNull java.util.Iterator<Component> iterator(@NotNull @NotNull ComponentIteratorType type, @NotNull @NotNull ComponentIteratorFlag @Nullable ... flags)
Returns an iterator for this component.As components are immutable, this iterator does not support removal.
- Parameters:
type
- the typeflags
- the flags- Returns:
- the iterator
- Since:
- 4.9.0
-
iterator
@NotNull default @NotNull java.util.Iterator<Component> iterator(@NotNull @NotNull ComponentIteratorType type, @NotNull @NotNull java.util.Set<ComponentIteratorFlag> flags)
Returns an iterator for this component.As components are immutable, this iterator does not support removal.
- Parameters:
type
- the typeflags
- the flags- Returns:
- the iterator
- Since:
- 4.9.0
-
spliterator
@NotNull default @NotNull java.util.Spliterator<Component> spliterator(@NotNull @NotNull ComponentIteratorType type, @NotNull @NotNull ComponentIteratorFlag @Nullable ... flags)
Returns a spliterator for this component.The resulting spliterator has the
Spliterator.IMMUTABLE
,Spliterator.NONNULL
andSpliterator.ORDERED
characteristics.- Parameters:
type
- the typeflags
- the flags- Returns:
- the spliterator
- Since:
- 4.9.0
-
spliterator
@NotNull default @NotNull java.util.Spliterator<Component> spliterator(@NotNull @NotNull ComponentIteratorType type, @NotNull @NotNull java.util.Set<ComponentIteratorFlag> flags)
Returns a spliterator for this component.The resulting spliterator has the
Spliterator.IMMUTABLE
,Spliterator.NONNULL
andSpliterator.ORDERED
characteristics.- Parameters:
type
- the typeflags
- the flags- Returns:
- the spliterator
- Since:
- 4.9.0
-
replaceText
@ScheduledForRemoval(inVersion="5.0.0") @Contract(pure=true) @Deprecated @NotNull default @NotNull Component replaceText(@NotNull @NotNull java.lang.String search, @Nullable @Nullable ComponentLike replacement)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.Finds and replaces text within anyComponent
s using a string literal.- Parameters:
search
- a string literalreplacement
- aComponentLike
to replace each match- Returns:
- a modified copy of this component
- Since:
- 4.0.0
-
replaceText
@ScheduledForRemoval(inVersion="5.0.0") @Contract(pure=true) @Deprecated @NotNull default @NotNull Component replaceText(@NotNull @NotNull java.util.regex.Pattern pattern, @NotNull @NotNull java.util.function.Function<TextComponent.Builder,@Nullable ComponentLike> replacement)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.Finds and replaces text within anyTextComponent
s using a regex pattern.- Parameters:
pattern
- a regex patternreplacement
- a function to replace each match- Returns:
- a modified copy of this component
- Since:
- 4.0.0
-
replaceFirstText
@ScheduledForRemoval(inVersion="5.0.0") @Contract(pure=true) @Deprecated @NotNull default @NotNull Component replaceFirstText(@NotNull @NotNull java.lang.String search, @Nullable @Nullable ComponentLike replacement)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.Finds and replaces the first occurrence of text within anyComponent
s using a string literal.- Parameters:
search
- a string literalreplacement
- aComponentLike
to replace the first match- Returns:
- a modified copy of this component
- Since:
- 4.0.0
-
replaceFirstText
@ScheduledForRemoval(inVersion="5.0.0") @Contract(pure=true) @Deprecated @NotNull default @NotNull Component replaceFirstText(@NotNull @NotNull java.util.regex.Pattern pattern, @NotNull @NotNull java.util.function.Function<TextComponent.Builder,@Nullable ComponentLike> replacement)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.Finds and replaces the first occurrence of text within anyTextComponent
s using a regex pattern.- Parameters:
pattern
- a regex patternreplacement
- a function to replace the first match- Returns:
- a modified copy of this component
- Since:
- 4.0.0
-
replaceText
@ScheduledForRemoval(inVersion="5.0.0") @Contract(pure=true) @Deprecated @NotNull default @NotNull Component replaceText(@NotNull @NotNull java.lang.String search, @Nullable @Nullable ComponentLike replacement, int numberOfReplacements)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.Finds and replacesn
instances of text within anyTextComponent
s using a string literal.- Parameters:
search
- a string literalreplacement
- aComponentLike
to replace the first matchnumberOfReplacements
- the amount of matches that should be replaced- Returns:
- a modified copy of this component
- Since:
- 4.0.0
-
replaceText
@ScheduledForRemoval(inVersion="5.0.0") @Contract(pure=true) @Deprecated @NotNull default @NotNull Component replaceText(@NotNull @NotNull java.util.regex.Pattern pattern, @NotNull @NotNull java.util.function.Function<TextComponent.Builder,@Nullable ComponentLike> replacement, int numberOfReplacements)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.Finds and replacesn
instances of text within anyTextComponent
s using a regex pattern.- Parameters:
pattern
- a regex patternreplacement
- a function to replace each matchnumberOfReplacements
- the amount of matches that should be replaced- Returns:
- a modified copy of this component
- Since:
- 4.0.0
-
replaceText
@ScheduledForRemoval(inVersion="5.0.0") @Contract(pure=true) @Deprecated @NotNull default @NotNull Component replaceText(@NotNull @NotNull java.lang.String search, @Nullable @Nullable ComponentLike replacement, @NotNull @NotNull IntFunction2<PatternReplacementResult> fn)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.Finds and replacesn
instances of text within anyTextComponent
s using a string literal.Utilises an
IntFunction2
to determine if each instance should be replaced.- Parameters:
search
- a string literalreplacement
- aComponentLike
to replace the first matchfn
- a function of (index, replaced) used to determine if matches should be replaced, where "replaced" is the number of successful replacements- Returns:
- a modified copy of this component
- Since:
- 4.0.0
-
replaceText
@ScheduledForRemoval(inVersion="5.0.0") @Contract(pure=true) @Deprecated @NotNull default @NotNull Component replaceText(@NotNull @NotNull java.util.regex.Pattern pattern, @NotNull @NotNull java.util.function.Function<TextComponent.Builder,@Nullable ComponentLike> replacement, @NotNull @NotNull IntFunction2<PatternReplacementResult> fn)
Deprecated.for removal since 4.2.0, usereplaceText(Consumer)
orreplaceText(TextReplacementConfig)
instead.Finds and replaces text using a regex pattern.Utilises an
IntFunction2
to determine if each instance should be replaced.- Parameters:
pattern
- a regex patternreplacement
- a function to replace the first matchfn
- a function of (index, replaced) used to determine if matches should be replaced, where "replaced" is the number of successful replacements- Returns:
- a modified copy of this component
- Since:
- 4.0.0
-
componentBuilderApply
default void componentBuilderApply(@NotNull @NotNull ComponentBuilder<?,?> component)
Description copied from interface:ComponentBuilderApplicable
Applies tocomponent
.- Specified by:
componentBuilderApply
in interfaceComponentBuilderApplicable
- Parameters:
component
- the component builder
-
asComponent
@NotNull default @NotNull Component asComponent()
Description copied from interface:ComponentLike
Gets aComponent
representation.- Specified by:
asComponent
in interfaceComponentLike
- Returns:
- a component
-
asHoverEvent
@NotNull default @NotNull HoverEvent<Component> asHoverEvent(@NotNull @NotNull java.util.function.UnaryOperator<Component> op)
Description copied from interface:HoverEventSource
Creates a hover event with value derived from this object.The event value will be passed through the provided callback to allow transforming the original value of the event.
- Specified by:
asHoverEvent
in interfaceHoverEventSource<Component>
- Parameters:
op
- transformation on value- Returns:
- a hover event
-
examinableProperties
@NotNull default @NotNull java.util.stream.Stream<? extends net.kyori.examination.ExaminableProperty> examinableProperties()
- Specified by:
examinableProperties
in interfacenet.kyori.examination.Examinable
-
-