@FunctionalInterface public interface MessageChannel
| Modifier and Type | Field and Description |
|---|---|
static MessageChannel |
TO_ALL
A channel with all online players, as well as the server console, as
members.
|
static MessageChannel |
TO_CONSOLE
A channel with the server console as a member.
|
static MessageChannel |
TO_NONE
A channel with no members.
|
static MessageChannel |
TO_PLAYERS
A channel with all online players as members.
|
| Modifier and Type | Method and Description |
|---|---|
default MutableMessageChannel |
asMutable()
Gets or creates a mutable version of this channel.
|
static MessageChannel |
combined(Collection<MessageChannel> channels)
Gets a message channel that targets all subjects contained within the
given channels and applies the message transformations of each channel in
order.
|
static MessageChannel |
combined(MessageChannel... channels)
Creates a message channel that targets all subjects contained within the
given channels and applies the message transformations of each channel in
order.
|
static MessageChannel |
fixed(Collection<? extends MessageReceiver> recipients)
Creates a message channel that targets the given recipients.
|
static MessageChannel |
fixed(MessageReceiver... recipients)
Creates a message channel that targets the given sources.
|
Collection<MessageReceiver> |
getMembers()
Gets a collection of all members in this channel.
|
static MessageChannel |
permission(String permission)
Creates a message channel that targets all subjects with the given
permission.
|
default void |
send(Object sender,
Text original)
Send a message to this channel, transforming and sending it to the
members.
|
default void |
send(Object sender,
Text original,
ChatType type)
Send a message to this channel, transforming and sending it to the
members.
|
default void |
send(Text original)
Broadcast a message to this channel, transforming and sending it to
the members.
|
default void |
send(Text original,
ChatType type)
Sends a message to this channel, transforming and sending it to
the members.
|
default Optional<Text> |
transformMessage(Object sender,
MessageReceiver recipient,
Text original,
ChatType type)
Handle transforming the input message appropriately.
|
static MessageChannel |
world(World world)
Creates a message channel that targets the given world.
|
static final MessageChannel TO_NONE
static final MessageChannel TO_PLAYERS
static final MessageChannel TO_CONSOLE
static final MessageChannel TO_ALL
static MessageChannel permission(String permission)
permission - The permission to targetPermissionMessageChannelstatic MessageChannel combined(MessageChannel... channels)
channels - The channels to combineCombinedMessageChannelstatic MessageChannel combined(Collection<MessageChannel> channels)
channels - The channels to combineCombinedMessageChannelstatic MessageChannel fixed(MessageReceiver... recipients)
recipients - The recipientsFixedMessageChannelstatic MessageChannel fixed(Collection<? extends MessageReceiver> recipients)
recipients - The recipientsFixedMessageChannelstatic MessageChannel world(World world)
world - The worldWorldMessageChanneldefault void send(Text original)
original - The original text to senddefault void send(Text original, ChatType type)
By default, the ChatTypes.SYSTEM type is used when sending
messages to applicable recipients of this channel.
original - The original text to sendtype - The type of messagedefault void send(@Nullable Object sender, Text original)
sender - The sender of the messageoriginal - The original message to senddefault void send(@Nullable Object sender, Text original, ChatType type)
sender - The sender of the messageoriginal - The original message to sendtype - The type of messagedefault Optional<Text> transformMessage(@Nullable Object sender, MessageReceiver recipient, Text original, ChatType type)
sender - The sender of the messagerecipient - The recipient of the messageoriginal - The original message, to optionally transformtype - The type of messageOptional.empty()Collection<MessageReceiver> getMembers()
default MutableMessageChannel asMutable()
The default behaviour of this method is to copy the current member
list into a DelegateMutableMessageChannel, which calls the
transformMessage(Object, MessageReceiver, Text, ChatType) method
on this channel.