Package com.winterhavenmc.library.messagebuilder.model.recipient
package com.winterhavenmc.library.messagebuilder.model.recipient
Contains a sealed model hierarchy representing classified message recipients
in a Bukkit-based command or messaging context.
This model is typically used by the message dispatch layer of the library to safely and clearly
manage how messages are sent based on the sender's context.
The Recipient
interface
and its nested types allow plugin developers to reason about the type of a CommandSender
at runtime using a type-safe, data-driven approach.
Recipient Categories
Recipient.Valid
– A standard, recognized sender such as a player, console, or command blockRecipient.Proxied
– AProxiedCommandSender
that represents a delegated command flowRecipient.Invalid
– A null or unsupported sender, accompanied by a reason code
Usage
The factory methodRecipient.of(CommandSender)
is used to classify any incoming CommandSender
, and returns a
sealed Recipient
subtype appropriate to its role.
Recipient recipient = Recipient.of(sender);
if (recipient instanceof Recipient.Sendable sendable) {
sendable.sender().sendMessage("Welcome!");
}
- See Also:
-
ClassDescriptionA sealed interface and its related types that represent different categories of message recipients in a player message context.Represents an invalid or unrecognized message recipient.Indicates the reason a
Recipient
was deemed invalid.Represents a proxied command sender (e.g., from another plugin or dispatch chain).A marker subinterface forRecipient
types that are capable of receiving messages directly.Represents a valid, recognized message recipient such as a player, console, or command block.