MAX_CHANNEL_SIZE, MAX_MESSAGE_SIZE
Constructor | Description |
---|---|
StandardMessenger() |
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 java.lang.String |
validateAndCorrectChannel(java.lang.String channel) |
Deprecated.
not an API method
|
static void |
validateChannel(java.lang.String channel) |
Deprecated.
not an API method
|
static void |
validatePluginMessage(Messenger messenger,
Plugin source,
java.lang.String channel,
byte[] message) |
Validates the input of a Plugin Message, ensuring the arguments are all
valid.
|
public boolean isReservedChannel(java.lang.String channel)
Messenger
isReservedChannel
in interface Messenger
channel
- Channel name to check.public void registerOutgoingPluginChannel(Plugin plugin, java.lang.String channel)
Messenger
registerOutgoingPluginChannel
in interface Messenger
plugin
- Plugin that wishes to send messages through the channel.channel
- Channel to register.public void unregisterOutgoingPluginChannel(Plugin plugin, java.lang.String channel)
Messenger
unregisterOutgoingPluginChannel
in interface Messenger
plugin
- Plugin that no longer wishes to send messages through the
channel.channel
- Channel to unregister.public void unregisterOutgoingPluginChannel(Plugin plugin)
Messenger
unregisterOutgoingPluginChannel
in interface Messenger
plugin
- Plugin that no longer wishes to send plugin messages.public PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, java.lang.String channel, PluginMessageListener listener)
Messenger
registerIncomingPluginChannel
in interface Messenger
plugin
- Plugin that wishes to register to this channel.channel
- Channel to register.listener
- Listener to receive messages on.public void unregisterIncomingPluginChannel(Plugin plugin, java.lang.String channel, PluginMessageListener listener)
Messenger
unregisterIncomingPluginChannel
in interface Messenger
plugin
- Plugin that wishes to unregister from this channel.channel
- Channel to unregister.listener
- Listener to stop receiving messages on.public void unregisterIncomingPluginChannel(Plugin plugin, java.lang.String channel)
Messenger
unregisterIncomingPluginChannel
in interface Messenger
plugin
- Plugin that wishes to unregister from this channel.channel
- Channel to unregister.public void unregisterIncomingPluginChannel(Plugin plugin)
Messenger
unregisterIncomingPluginChannel
in interface Messenger
plugin
- Plugin that wishes to unregister from this channel.public java.util.Set<java.lang.String> getOutgoingChannels()
Messenger
getOutgoingChannels
in interface Messenger
public java.util.Set<java.lang.String> getOutgoingChannels(Plugin plugin)
Messenger
getOutgoingChannels
in interface Messenger
plugin
- Plugin to retrieve channels for.public java.util.Set<java.lang.String> getIncomingChannels()
Messenger
getIncomingChannels
in interface Messenger
public java.util.Set<java.lang.String> getIncomingChannels(Plugin plugin)
Messenger
getIncomingChannels
in interface Messenger
plugin
- Plugin to retrieve channels for.public java.util.Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(Plugin plugin)
Messenger
getIncomingChannelRegistrations
in interface Messenger
plugin
- Plugin to retrieve registrations for.public java.util.Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(java.lang.String channel)
Messenger
getIncomingChannelRegistrations
in interface Messenger
channel
- Channel to retrieve registrations for.public java.util.Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(Plugin plugin, java.lang.String channel)
Messenger
getIncomingChannelRegistrations
in interface Messenger
plugin
- Plugin to retrieve registrations for.channel
- Channel to filter registrations by.public boolean isRegistrationValid(PluginMessageListenerRegistration registration)
Messenger
A registration is considered valid if it has not be unregistered and that the plugin is still enabled.
isRegistrationValid
in interface Messenger
registration
- Registration to check.public boolean isIncomingChannelRegistered(Plugin plugin, java.lang.String channel)
Messenger
isIncomingChannelRegistered
in interface Messenger
plugin
- Plugin to check registration for.channel
- Channel to test for.public boolean isOutgoingChannelRegistered(Plugin plugin, java.lang.String channel)
Messenger
isOutgoingChannelRegistered
in interface Messenger
plugin
- Plugin to check registration for.channel
- Channel to test for.public void dispatchIncomingMessage(Player source, java.lang.String channel, byte[] message)
Messenger
dispatchIncomingMessage
in interface Messenger
source
- Source of the message.channel
- Channel that the message was sent by.message
- Raw payload of the message.@Deprecated public static void validateChannel(java.lang.String channel)
channel
- Channel name to validate.@Deprecated public static java.lang.String validateAndCorrectChannel(java.lang.String channel)
channel
- Channel name to validate.public static void validatePluginMessage(Messenger messenger, Plugin source, java.lang.String channel, byte[] message)
messenger
- Messenger to use for validation.source
- Source plugin of the Message.channel
- Plugin Channel to send the message by.message
- Raw message payload to send.java.lang.IllegalArgumentException
- Thrown if the source plugin is
disabled.java.lang.IllegalArgumentException
- Thrown if source, channel or message
is null.MessageTooLargeException
- Thrown if the message is too big.ChannelNameTooLongException
- Thrown if the channel name is too
long.ChannelNotRegisteredException
- Thrown if the channel is not
registered for this plugin.Copyright © 2018. All rights reserved.