StandardMessenger
public interface Messenger
NamespacedKey
. The "BungeeCord" channel is
an exception and may only take this form.Modifier and Type | Field | Description |
---|---|---|
static int |
MAX_CHANNEL_SIZE |
Represents the largest size that a Plugin Channel may be.
|
static int |
MAX_MESSAGE_SIZE |
Represents the largest size that an individual Plugin Message may be.
|
Modifier and Type | Method | Description |
---|---|---|
void |
dispatchIncomingMessage(Player source,
java.lang.String channel,
byte[] message) |
Dispatches the specified incoming message to any registered listeners.
|
java.util.Set<PluginMessageListenerRegistration> |
getIncomingChannelRegistrations(java.lang.String channel) |
Gets a set containing all the incoming plugin channel registrations
that are on the requested channel.
|
java.util.Set<PluginMessageListenerRegistration> |
getIncomingChannelRegistrations(Plugin plugin) |
Gets a set containing all the incoming plugin channel registrations
that the specified plugin has.
|
java.util.Set<PluginMessageListenerRegistration> |
getIncomingChannelRegistrations(Plugin plugin,
java.lang.String channel) |
Gets a set containing all the incoming plugin channel registrations
that the specified plugin has on the requested channel.
|
java.util.Set<java.lang.String> |
getIncomingChannels() |
Gets a set containing all the incoming plugin channels.
|
java.util.Set<java.lang.String> |
getIncomingChannels(Plugin plugin) |
Gets a set containing all the incoming plugin channels that the
specified plugin is registered for.
|
java.util.Set<java.lang.String> |
getOutgoingChannels() |
Gets a set containing all the outgoing plugin channels.
|
java.util.Set<java.lang.String> |
getOutgoingChannels(Plugin plugin) |
Gets a set containing all the outgoing plugin channels that the
specified plugin is registered to.
|
boolean |
isIncomingChannelRegistered(Plugin plugin,
java.lang.String channel) |
Checks if the specified plugin has registered to receive incoming
messages through the requested channel.
|
boolean |
isOutgoingChannelRegistered(Plugin plugin,
java.lang.String channel) |
Checks if the specified plugin has registered to send outgoing messages
through the requested channel.
|
boolean |
isRegistrationValid(PluginMessageListenerRegistration registration) |
Checks if the specified plugin message listener registration is valid.
|
boolean |
isReservedChannel(java.lang.String channel) |
Checks if the specified channel is a reserved name.
|
PluginMessageListenerRegistration |
registerIncomingPluginChannel(Plugin plugin,
java.lang.String channel,
PluginMessageListener listener) |
Registers the specific plugin for listening on the requested incoming
plugin channel, allowing it to act upon any plugin messages.
|
void |
registerOutgoingPluginChannel(Plugin plugin,
java.lang.String channel) |
Registers the specific plugin to the requested outgoing plugin channel,
allowing it to send messages through that channel to any clients.
|
void |
unregisterIncomingPluginChannel(Plugin plugin) |
Unregisters the specific plugin from listening on all plugin channels
through all listeners.
|
void |
unregisterIncomingPluginChannel(Plugin plugin,
java.lang.String channel) |
Unregisters the specific plugin from listening on the requested
incoming plugin channel, no longer allowing it to act upon any plugin
messages.
|
void |
unregisterIncomingPluginChannel(Plugin plugin,
java.lang.String channel,
PluginMessageListener listener) |
Unregisters the specific plugin's listener from listening on the
requested incoming plugin channel, no longer allowing it to act upon
any plugin messages.
|
void |
unregisterOutgoingPluginChannel(Plugin plugin) |
Unregisters the specific plugin from all outgoing plugin channels, no
longer allowing it to send any plugin messages.
|
void |
unregisterOutgoingPluginChannel(Plugin plugin,
java.lang.String channel) |
Unregisters the specific plugin from the requested outgoing plugin
channel, no longer allowing it to send messages through that channel to
any clients.
|
static final int MAX_MESSAGE_SIZE
static final int MAX_CHANNEL_SIZE
boolean isReservedChannel(java.lang.String channel)
channel
- Channel name to check.java.lang.IllegalArgumentException
- Thrown if channel is null.void registerOutgoingPluginChannel(Plugin plugin, java.lang.String channel)
plugin
- Plugin that wishes to send messages through the channel.channel
- Channel to register.java.lang.IllegalArgumentException
- Thrown if plugin or channel is null.void unregisterOutgoingPluginChannel(Plugin plugin, java.lang.String channel)
plugin
- Plugin that no longer wishes to send messages through the
channel.channel
- Channel to unregister.java.lang.IllegalArgumentException
- Thrown if plugin or channel is null.void unregisterOutgoingPluginChannel(Plugin plugin)
plugin
- Plugin that no longer wishes to send plugin messages.java.lang.IllegalArgumentException
- Thrown if plugin is null.PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, java.lang.String channel, PluginMessageListener listener)
plugin
- Plugin that wishes to register to this channel.channel
- Channel to register.listener
- Listener to receive messages on.java.lang.IllegalArgumentException
- Thrown if plugin, channel or listener
is null, or the listener is already registered for this channel.void unregisterIncomingPluginChannel(Plugin plugin, java.lang.String channel, PluginMessageListener listener)
plugin
- Plugin that wishes to unregister from this channel.channel
- Channel to unregister.listener
- Listener to stop receiving messages on.java.lang.IllegalArgumentException
- Thrown if plugin, channel or listener
is null.void unregisterIncomingPluginChannel(Plugin plugin, java.lang.String channel)
plugin
- Plugin that wishes to unregister from this channel.channel
- Channel to unregister.java.lang.IllegalArgumentException
- Thrown if plugin or channel is null.void unregisterIncomingPluginChannel(Plugin plugin)
plugin
- Plugin that wishes to unregister from this channel.java.lang.IllegalArgumentException
- Thrown if plugin is null.java.util.Set<java.lang.String> getOutgoingChannels()
java.util.Set<java.lang.String> getOutgoingChannels(Plugin plugin)
plugin
- Plugin to retrieve channels for.java.lang.IllegalArgumentException
- Thrown if plugin is null.java.util.Set<java.lang.String> getIncomingChannels()
java.util.Set<java.lang.String> getIncomingChannels(Plugin plugin)
plugin
- Plugin to retrieve channels for.java.lang.IllegalArgumentException
- Thrown if plugin is null.java.util.Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(Plugin plugin)
plugin
- Plugin to retrieve registrations for.java.lang.IllegalArgumentException
- Thrown if plugin is null.java.util.Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(java.lang.String channel)
channel
- Channel to retrieve registrations for.java.lang.IllegalArgumentException
- Thrown if channel is null.java.util.Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(Plugin plugin, java.lang.String channel)
plugin
- Plugin to retrieve registrations for.channel
- Channel to filter registrations by.java.lang.IllegalArgumentException
- Thrown if plugin or channel is null.boolean isRegistrationValid(PluginMessageListenerRegistration registration)
A registration is considered valid if it has not be unregistered and that the plugin is still enabled.
registration
- Registration to check.boolean isIncomingChannelRegistered(Plugin plugin, java.lang.String channel)
plugin
- Plugin to check registration for.channel
- Channel to test for.boolean isOutgoingChannelRegistered(Plugin plugin, java.lang.String channel)
plugin
- Plugin to check registration for.channel
- Channel to test for.void dispatchIncomingMessage(Player source, java.lang.String channel, byte[] message)
source
- Source of the message.channel
- Channel that the message was sent by.message
- Raw payload of the message.Copyright © 2018. All rights reserved.