Class ValidMessage
java.lang.Object
com.winterhavenmc.library.messagebuilder.core.message.ValidMessage
- All Implemented Interfaces:
Message
A concrete implementation of
Message representing a fully constructed,
resolvable, and sendable message.
This class encapsulates all components required to render and dispatch a message:
- A
recipient - A
messageKeyidentifying the template - A
Pipelineto handle rendering and delivery - A
com.winterhavenmc.library.messagebuilder.pipeline.maps.MacroObjectMap macro object mapholding values to be substituted into the message
[RECIPIENT}.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionValidMessage(org.bukkit.plugin.Plugin plugin, Recipient.Sendable recipient, ValidMessageKey messageKey, Pipeline messagePipeline) Class constructor -
Method Summary
Modifier and TypeMethodDescriptionReturns theValidMessageKeyidentifying the message template used in composition.Returns theMacroObjectMapof macro values bound to this message.Returns theRecipient.Sendableto whom the message will be sent.booleansend()Sends the composed message to the resolved recipient, if valid.setMacro(int quantity, K macro, V value) Associates a macro string with a value and explicit quantity, useful for pluralization or contextual substitution that depends on numeric counts.setMacro(K macro, Duration duration, ChronoUnit lowerBound) Associates a duration with the given macro string, using a defined precision.setMacro(K macro, V value) Associates a macro string with a value for later substitution during message rendering.
-
Constructor Details
-
ValidMessage
public ValidMessage(org.bukkit.plugin.Plugin plugin, Recipient.Sendable recipient, ValidMessageKey messageKey, Pipeline messagePipeline) Class constructor- Parameters:
recipient- message recipientmessageKey- message identifiermessagePipeline- the message processor that will receive the message when the send method is called
-
-
Method Details
-
setMacro
Description copied from interface:MessageAssociates a macro string with a value for later substitution during message rendering. -
setMacro
Description copied from interface:MessageAssociates a macro string with a value and explicit quantity, useful for pluralization or contextual substitution that depends on numeric counts. -
setMacro
Description copied from interface:MessageAssociates a duration with the given macro string, using a defined precision.- Specified by:
setMacroin interfaceMessage- Type Parameters:
K- the enum type of the macro- Parameters:
macro- the macro stringduration- theDurationto be formatted and resolvedlowerBound- theChronoUnitto control formatting granularity- Returns:
- the same
Messageinstance, for fluent chaining
-
send
public boolean send()Description copied from interface:MessageSends the composed message to the resolved recipient, if valid.No-op if the message is invalid or the recipient is missing or unsupported.
-
getMessageKey
Description copied from interface:MessageReturns theValidMessageKeyidentifying the message template used in composition.- Specified by:
getMessageKeyin interfaceMessage- Returns:
- the message string
-
getRecipient
Description copied from interface:MessageReturns theRecipient.Sendableto whom the message will be sent.- Specified by:
getRecipientin interfaceMessage- Returns:
- the message recipient
-
getObjectMap
Description copied from interface:MessageReturns theMacroObjectMapof macro values bound to this message.- Specified by:
getObjectMapin interfaceMessage- Returns:
- the macro object map
-