Package net.kyori.adventure.text
Class AbstractComponent
java.lang.Object
net.kyori.adventure.text.AbstractComponent
- All Implemented Interfaces:
Component,ComponentBuilderApplicable,ComponentLike,HoverEventSource<Component>,net.kyori.examination.Examinable
public abstract class AbstractComponent extends Object implements Component
An abstract implementation of a text component.
- Since:
- 4.0.0
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractComponent(@NonNull List<? extends ComponentLike> children, @NonNull Style style) -
Method Summary
Modifier and Type Method Description @NonNull List<Component>children()Gets the unmodifiable list of children.booleanequals(@Nullable Object other)@NonNull Stream<? extends net.kyori.examination.ExaminableProperty>examinableProperties()inthashCode()@NonNull ComponentreplaceText(@NonNull Pattern pattern, @NonNull Function<TextComponent.Builder,@Nullable ComponentLike> replacement, @NonNull IntFunction2<PatternReplacementResult> fn)Finds and replaces text using a regex pattern.@NonNull Stylestyle()Gets the style of this component.StringtoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.kyori.adventure.text.Component
append, append, append, asComponent, asHoverEvent, children, clickEvent, clickEvent, color, color, colorIfAbsent, componentBuilderApply, contains, decorate, decoration, decoration, decoration, decorations, decorations, detectCycle, hasDecoration, hasStyling, hoverEvent, hoverEvent, insertion, insertion, mergeStyle, mergeStyle, mergeStyle, replaceFirstText, replaceFirstText, replaceText, replaceText, replaceText, replaceText, replaceText, style, style, style, style
-
Field Details
-
Constructor Details
-
Method Details
-
children
Description copied from interface:ComponentGets the unmodifiable list of children. -
style
Description copied from interface:ComponentGets the style of this component. -
replaceText
public @NonNull Component replaceText(@NonNull Pattern pattern, @NonNull Function<TextComponent.Builder,@Nullable ComponentLike> replacement, @NonNull IntFunction2<PatternReplacementResult> fn)Description copied from interface:ComponentFinds and replaces text using a regex pattern.Utilises an
IntFunction2to determine if each instance should be replaced.- Specified by:
replaceTextin interfaceComponent- 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
-
equals
-
hashCode
public int hashCode() -
examinableProperties
- Specified by:
examinablePropertiesin interfacenet.kyori.examination.Examinable
-
toString
-