Interface MessageRecord
- All Superinterfaces:
SectionRecord
- All Known Implementing Classes:
FinalMessageRecord,InvalidMessageRecord,ValidMessageRecord
public sealed interface MessageRecord
extends SectionRecord
permits ValidMessageRecord, InvalidMessageRecord, FinalMessageRecord
A sealed interface representing a structured message record loaded from the
MESSAGES
section of a language YAML file.
A MessageRecord contains all the information required to display text or titles
to players using templated and macro-resolved content. This includes:
- A main message body (chat message)
- An optional title/subtitle display
- Timing controls (title fade-in, stay, and fade-out durations)
- Optional repeat delay for messages that would otherwise repeat too frequently
Implementations
ValidMessageRecord– A fully validated message loaded from configurationInvalidMessageRecord– A message record representing an invalid or missing configurationFinalMessageRecord– An immutable, rendered message derived from a valid record
Factory Methods
Useof(ValidMessageKey, ConfigurationSection) to parse a configuration section,
or empty(RecordKey, InvalidRecordReason) to create an invalid placeholder when parsing fails.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumEnum representing the fields defined in aValidMessageRecord. -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic InvalidMessageRecordempty(RecordKey messageKey, InvalidRecordReason reason) Returns anInvalidMessageRecordrepresenting a missing or invalid message definition.static MessageRecordof(ValidMessageKey messageKey, org.bukkit.configuration.ConfigurationSection messageEntry) Factory method that constructs aMessageRecordfrom a YAML configuration section.Methods inherited from interface com.winterhavenmc.library.messagebuilder.models.language.SectionRecord
key
-
Method Details
-
of
static MessageRecord of(ValidMessageKey messageKey, org.bukkit.configuration.ConfigurationSection messageEntry) Factory method that constructs aMessageRecordfrom a YAML configuration section. Returns aValidMessageRecordif the section is non-null and valid, or anInvalidMessageRecordif the section is missing.- Parameters:
messageKey- the unique record string used to identify this messagemessageEntry- the corresponding YAML configuration section- Returns:
- a valid or invalid
MessageRecorddepending on input
-
empty
Returns anInvalidMessageRecordrepresenting a missing or invalid message definition.- Parameters:
messageKey- the string associated with the missing record- Returns:
- a placeholder
MessageRecordindicating an empty or unresolved message
-