java.lang.Object
com.winterhavenmc.library.messagebuilder.model.language.ValidMessageRecord
All Implemented Interfaces:
MessageRecord, SectionRecord

public final class ValidMessageRecord extends Object implements MessageRecord
A validated, immutable MessageRecord representing a single entry from the MESSAGES section of a language YAML file.

This record contains the full structure of a templated message, including:

  • A unique RecordKey
  • A plain-text message body (with placeholders)
  • Optional title and subtitle text
  • Title animation parameters (fade-in, stay, fade-out durations)
  • An optional repeat delay for scheduled messages

This class is created via the create(RecordKey, ConfigurationSection) factory method, which performs all necessary validation and applies default values where appropriate. Once constructed, instances are considered safe and complete and can be used without additional checks.

See Also:
  • Method Details

    • create

      public static ValidMessageRecord create(RecordKey key, org.bukkit.configuration.ConfigurationSection section)
      Creates a ValidMessageRecord from a YAML configuration section.

      All expected fields are validated or defaulted according to their definitions in MessageRecord.Field. If a field is missing, a sensible default is applied.

      Parameters:
      key - the record key representing this message
      section - the configuration section containing the message definition
      Returns:
      a new, fully validated ValidMessageRecord
    • withFinalStrings

      public FinalMessageRecord withFinalStrings(String finalMessageString, String finalTitleString, String finalSubTitleString)
      Creates a FinalMessageRecord using the current record data, combined with finalized message, title, and subtitle strings after macro resolution.

      This is typically used as the last step in the message pipeline before dispatch.

      Parameters:
      finalMessageString - the resolved chat message string
      finalTitleString - the resolved title string
      finalSubTitleString - the resolved subtitle string
      Returns:
      a FinalMessageRecord that includes the resolved strings
    • key

      public RecordKey key()
      Specified by:
      key in interface SectionRecord
    • enabled

      public boolean enabled()
    • message

      public String message()
    • repeatDelay

      public Duration repeatDelay()
    • title

      public String title()
    • titleFadeIn

      public int titleFadeIn()
    • titleStay

      public int titleStay()
    • titleFadeOut

      public int titleFadeOut()
    • subtitle

      public String subtitle()