java.lang.Object
com.winterhavenmc.library.messagebuilder.pipeline.sender.MessageSender
All Implemented Interfaces:
Sender

public final class MessageSender extends Object implements Sender
Sends chat messages to a Recipient.Sendable based on the contents of a FinalMessageRecord.

This implementation handles:

  • Chat color translation using '&' codes
  • Empty or disabled messages gracefully
  • Cooldown tracking via a CooldownMap

It is typically used to deliver the main message body, rather than titles or subtitles.

See Also:
  • Constructor Details

    • MessageSender

      public MessageSender(CooldownMap cooldownMap)
      Constructs a MessageSender with the specified cooldown map for managing message repeat suppression.
      Parameters:
      cooldownMap - the cooldown map used to track and store message cooldowns
  • Method Details

    • send

      public void send(Recipient.Sendable recipient, FinalMessageRecord messageRecord)
      Sends a chat message to the specified recipient if the message is enabled and contains content. Cooldowns are recorded after sending.

      The message text is color-translated using '&' codes.

      Specified by:
      send in interface Sender
      Parameters:
      recipient - the message recipient
      messageRecord - the final message record with resolved string content