Class ChatRendererFeature
java.lang.Object
ovh.mythmc.social.api.chat.renderer.feature.ChatRendererFeature
Represents a feature that can be applied when rendering chat messages.
A ChatRendererFeature encapsulates:
- a
ChatRendererFeature.Handlerthat modifies the message format before rendering, - a
ChatRendererFeature.Decoratorthat can modify theComponentvisually, - a
Predicatecondition that determines whether this feature applies to a given message context.
Features can be created using the static builder(Handler) method or with specialized helper methods
such as replies(int) and companion(). Builders allow additional customization
of the condition and decorator before building the final feature.
Usage Example:
ChatRendererFeature repliesFeature = ChatRendererFeature.replies(0);
ChatRendererFeature companionFeature = ChatRendererFeature.companion();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classChatRendererFeature.Builder<T extends ChatRendererFeature.Builder<T,R>, R extends ChatRendererFeature> Builder forChatRendererFeature.static final classBuilder implementation for simple chat features.static interfaceFunctional interface representing a decorator that can visually modify a message'sComponent.static interfaceFunctional interface representing a handler that modifies a message's format before rendering. -
Method Summary
Modifier and TypeMethodDescriptionbuilder(@NotNull ChatRendererFeature.Handler handler) Creates a builder for a custom chat feature.static ChatRendererFeatureReturns a feature that appends companion-related components to messages, if the sender has a companion.Returns theChatRendererFeature.Decoratorof this feature.handler()Returns theChatRendererFeature.Handlerof this feature.booleanTests whether this feature is applicable to a given message context.static ChatRendererFeaturereplies(int injectionIndex) Returns a feature that renders reply icons for messages that are replies.
-
Method Details
-
builder
public static ChatRendererFeature.ChatFeatureBuilder builder(@NotNull @NotNull ChatRendererFeature.Handler handler) Creates a builder for a custom chat feature.- Parameters:
handler- the handler to modify the message format- Returns:
- a
ChatRendererFeature.ChatFeatureBuilderfor configuring decorators and conditions
-
replies
Returns a feature that renders reply icons for messages that are replies.- Parameters:
injectionIndex- the index in the format to inject the reply icon- Returns:
- a
ChatRendererFeaturethat applies reply icons
-
companion
Returns a feature that appends companion-related components to messages, if the sender has a companion.- Returns:
- a
ChatRendererFeaturefor rendering companions
-
handler
Returns theChatRendererFeature.Handlerof this feature. -
decorator
Returns theChatRendererFeature.Decoratorof this feature. -
isApplicable
Tests whether this feature is applicable to a given message context.- Parameters:
context- theSocialRegisteredMessageContextto test- Returns:
- true if this feature applies, false otherwise
-