Class AbstractMessageManager
This abstraction handles the processing of KMessage
instances, including
placeholder replacement, action attachment, and version-appropriate message
delivery. It supports both single-line and multi-line messages with rich
interactive features like hover text, click actions, and item displays.
The manager processes messages by replacing placeholders with their corresponding
Action
replacements, attaching interactive events, and then sending the
final message to the recipient using version-specific methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
processAndSend
(@NotNull CommandSender sender, @NotNull KMessage message) Processes and sends a message with all actions and replacements applied.final void
processAndSend
(@NotNull CommandSender sender, @NotNull KMessage... messages) Processes and sends multiple messages provided as varargs.final void
processAndSend
(@NotNull CommandSender sender, @NotNull String line, boolean translate, @NotNull Action... actions) Processes and sends a single line message with translation control.final void
processAndSend
(@NotNull CommandSender sender, @NotNull String line, @NotNull Action... actions) Processes and sends a single line message with the specified actions.final void
processAndSend
(@NotNull CommandSender sender, @NotNull List<KMessage> messages) Processes and sends multiple messages sequentially.final void
processAndSend
(@NotNull CommandSender sender, @NotNull List<String> lines, @NotNull Action... actions) Processes and sends a multi-line message with the specified actions.
-
Constructor Details
-
AbstractMessageManager
public AbstractMessageManager()
-
-
Method Details
-
processAndSend
public void processAndSend(@NotNull @NotNull CommandSender sender, @NotNull @NotNull KMessage message) Processes and sends a message with all actions and replacements applied.This method handles the complete message processing pipeline including placeholder replacement, action processing, and final delivery to the recipient.
- Parameters:
sender
- theCommandSender
to send the message tomessage
- theKMessage
to process and send
-
processAndSend
public final void processAndSend(@NotNull @NotNull CommandSender sender, @NotNull @NotNull List<KMessage> messages) Processes and sends multiple messages sequentially.This convenience method processes each message in the list individually, maintaining the order of messages. Each message is fully processed before the next one is handled.
- Parameters:
sender
- theCommandSender
to send the messages tomessages
- the list ofKMessage
instances to process and send
-
processAndSend
public final void processAndSend(@NotNull @NotNull CommandSender sender, @NotNull @NotNull KMessage... messages) Processes and sends multiple messages provided as varargs.This convenience method converts the varargs array to a list and processes each message sequentially. It provides a fluent interface for sending multiple messages without creating explicit collections.
- Parameters:
sender
- theCommandSender
to send the messages tomessages
- theKMessage
instances to process and send
-
processAndSend
public final void processAndSend(@NotNull @NotNull CommandSender sender, @NotNull @NotNull String line, @NotNull @NotNull Action... actions) Processes and sends a single line message with the specified actions.This convenience method creates a
KMessageSingle
from the provided line and actions, then processes and sends it. This is useful for simple single-line messages with interactive elements.- Parameters:
sender
- theCommandSender
to send the message toline
- the text content of the messageactions
- theAction
instances to attach to the message
-
processAndSend
public final void processAndSend(@NotNull @NotNull CommandSender sender, @NotNull @NotNull String line, boolean translate, @NotNull @NotNull Action... actions) Processes and sends a single line message with translation control.This convenience method creates a
KMessageSingle
with the specified translation setting. The translation flag determines whether color codes and other formatting should be processed during message sending.- Parameters:
sender
- theCommandSender
to send the message toline
- the text content of the messagetranslate
- whether to process formatting codes and translationsactions
- theAction
instances to attach to the message
-
processAndSend
public final void processAndSend(@NotNull @NotNull CommandSender sender, @NotNull @NotNull List<String> lines, @NotNull @NotNull Action... actions) Processes and sends a multi-line message with the specified actions.This convenience method creates a
KMessageBlock
from the provided lines and actions, then processes and sends it. This is useful for multi-line messages like help text or information displays.- Parameters:
sender
- theCommandSender
to send the message tolines
- the list of text lines that make up the messageactions
- theAction
instances to attach to the message
-