Class ValidMessageRecord
java.lang.Object
com.winterhavenmc.library.messagebuilder.model.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
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.winterhavenmc.library.messagebuilder.model.language.MessageRecord
MessageRecord.Field
-
Method Summary
Modifier and TypeMethodDescriptionstatic ValidMessageRecord
Creates aValidMessageRecord
from a YAML configuration section.boolean
enabled()
key()
message()
subtitle()
title()
int
int
int
withFinalStrings
(String finalMessageString, String finalTitleString, String finalSubTitleString) Creates aFinalMessageRecord
using the current record data, combined with finalized message, title, and subtitle strings after macro resolution.
-
Method Details
-
create
public static ValidMessageRecord create(RecordKey key, org.bukkit.configuration.ConfigurationSection section) Creates aValidMessageRecord
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 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 aFinalMessageRecord
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 stringfinalTitleString
- the resolved title stringfinalSubTitleString
- the resolved subtitle string- Returns:
- a
FinalMessageRecord
that includes the resolved strings
-
key
- Specified by:
key
in interfaceSectionRecord
-
enabled
public boolean enabled() -
message
-
repeatDelay
-
title
-
titleFadeIn
public int titleFadeIn() -
titleStay
public int titleStay() -
titleFadeOut
public int titleFadeOut() -
subtitle
-