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 TypeMethodDescriptionvoidprocessAndSend(@NotNull CommandSender sender, @NotNull KMessage message) Processes and sends a message with all actions and replacements applied.final voidprocessAndSend(@NotNull CommandSender sender, @NotNull KMessage... messages) Processes and sends multiple messages provided as varargs.final voidprocessAndSend(@NotNull CommandSender sender, @NotNull String line, boolean translate, @NotNull Action... actions) Processes and sends a single line message with translation control.final voidprocessAndSend(@NotNull CommandSender sender, @NotNull String line, @NotNull Action... actions) Processes and sends a single line message with the specified actions.final voidprocessAndSend(@NotNull CommandSender sender, @NotNull List<KMessage> messages) Processes and sends multiple messages sequentially.final voidprocessAndSend(@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- theCommandSenderto send the message tomessage- theKMessageto 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- theCommandSenderto send the messages tomessages- the list ofKMessageinstances 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- theCommandSenderto send the messages tomessages- theKMessageinstances 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
KMessageSinglefrom the provided line and actions, then processes and sends it. This is useful for simple single-line messages with interactive elements.- Parameters:
sender- theCommandSenderto send the message toline- the text content of the messageactions- theActioninstances 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
KMessageSinglewith the specified translation setting. The translation flag determines whether color codes and other formatting should be processed during message sending.- Parameters:
sender- theCommandSenderto send the message toline- the text content of the messagetranslate- whether to process formatting codes and translationsactions- theActioninstances 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
KMessageBlockfrom 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- theCommandSenderto send the message tolines- the list of text lines that make up the messageactions- theActioninstances to attach to the message
-