public class CombinedMessageChannel extends Object implements MessageChannel
channels[n-1].transformMessage(channels[n-2]
.transformMessage(channels[...]
.transformMessage(channels[0].transformMessage(input))))
would occur).Modifier and Type | Field and Description |
---|---|
protected Collection<MessageChannel> |
channels |
TO_ALL, TO_CONSOLE, TO_NONE, TO_PLAYERS
Constructor and Description |
---|
CombinedMessageChannel(Collection<MessageChannel> channels)
Creates a new combined message channel of the provided
Collection
of MessageChannel s. |
CombinedMessageChannel(MessageChannel... channels)
Creates a new combined message channel of the provided
MessageChannel s. |
Modifier and Type | Method and Description |
---|---|
Collection<MessageReceiver> |
getMembers()
Gets a collection of all members in this channel.
|
Optional<Text> |
transformMessage(Object sender,
MessageReceiver recipient,
Text original,
ChatType type)
Handle transforming the input message appropriately.
|
protected final Collection<MessageChannel> channels
public CombinedMessageChannel(MessageChannel... channels)
MessageChannel
s.channels
- The channels to combine into a single message channelpublic CombinedMessageChannel(Collection<MessageChannel> channels)
Collection
of MessageChannel
s.channels
- The channels to combine into a single message channelpublic Optional<Text> transformMessage(@Nullable Object sender, MessageReceiver recipient, Text original, ChatType type)
MessageChannel
transformMessage
in interface MessageChannel
sender
- The sender of the messagerecipient
- The recipient of the messageoriginal
- The original message, to optionally transformtype
- The type of messageOptional.empty()
public Collection<MessageReceiver> getMembers()
MessageChannel
getMembers
in interface MessageChannel