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

public final class TitleSender extends Object implements Sender
Sends a title and optional subtitle to a Player using values from a FinalMessageRecord.

This implementation ensures that:

  • Only players receive title messages (non-player senders are ignored)
  • Title and subtitle strings are validated for presence before sending
  • Colors are translated using '&' codes
  • Cooldowns are applied using the provided CooldownMap
See Also:
  • Constructor Details

    • TitleSender

      public TitleSender(CooldownMap cooldownMap)
      Constructs a TitleSender using the specified cooldown map.
      Parameters:
      cooldownMap - an instance of the message cooldown map used to prevent redundant delivery
  • Method Details

    • send

      public void send(Recipient.Sendable recipient, FinalMessageRecord messageRecord)
      Sends a title and subtitle to a player if applicable, using values from the given message record.

      This method checks whether the sender is a Player, whether the message is enabled, and whether at least one of the final title or subtitle strings is non-empty. Cooldown state is recorded upon successful delivery.

      Specified by:
      send in interface Sender
      Parameters:
      recipient - the message recipient
      messageRecord - the message record containing the title, subtitle, and timing data