Class AbstractMessageManager

java.lang.Object
com.kamikazejam.kamicommon.nms.abstraction.chat.AbstractMessageManager

public abstract class AbstractMessageManager extends Object
Abstract class providing version-specific implementations for processing and sending interactive messages with actions and events.

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 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 - the CommandSender to send the message to
      message - the KMessage 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 - the CommandSender to send the messages to
      messages - the list of KMessage 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 - the CommandSender to send the messages to
      messages - the KMessage 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 - the CommandSender to send the message to
      line - the text content of the message
      actions - the Action 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 - the CommandSender to send the message to
      line - the text content of the message
      translate - whether to process formatting codes and translations
      actions - the Action 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 - the CommandSender to send the message to
      lines - the list of text lines that make up the message
      actions - the Action instances to attach to the message