Class ValidMessageRecord
java.lang.Object
com.winterhavenmc.library.messagebuilder.models.language.ValidMessageRecord
- All Implemented Interfaces:
MessageRecord,SectionRecord
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
ValidMessageKey - 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(ValidMessageKey, 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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.winterhavenmc.library.messagebuilder.models.language.MessageRecord
MessageRecord.Field -
Method Summary
Modifier and TypeMethodDescriptionstatic ValidMessageRecordcreate(ValidMessageKey key, org.bukkit.configuration.ConfigurationSection section) Creates aValidMessageRecordfrom a YAML configuration section.booleanenabled()key()message()subtitle()title()withFinalStrings(String finalMessageString, String finalTitleString, String finalSubTitleString) Creates aFinalMessageRecordusing the current record data, combined with finalized message, title, and subtitle strings after macro resolution.
-
Method Details
-
create
public static ValidMessageRecord create(ValidMessageKey key, org.bukkit.configuration.ConfigurationSection section) Creates aValidMessageRecordfrom 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 string representing this messagesection- the configuration section containing the message definition- Returns:
- a new, fully validated
ValidMessageRecord
-
withFinalStrings
public FinalMessageRecord withFinalStrings(String finalMessageString, String finalTitleString, String finalSubTitleString) Creates aFinalMessageRecordusing 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 stringfinalTitleString- the resolved title stringfinalSubTitleString- the resolved subtitle string- Returns:
- a
FinalMessageRecordthat includes the resolved strings
-
key
- Specified by:
keyin interfaceSectionRecord
-
enabled
public boolean enabled() -
message
-
repeatDelay
-
title
-
titleFadeIn
-
titleStay
-
titleFadeOut
-
subtitle
-