public interface Messenger
NamespacedKey
. The "BungeeCord" channel is
an exception and may only take this form.Modifier and Type | Field and 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 and Description |
---|---|
void |
dispatchIncomingMessage(@NotNull Player source,
@NotNull String channel,
@NotNull byte[] message)
Dispatches the specified incoming message to any registered listeners.
|
@NotNull Set<PluginMessageListenerRegistration> |
getIncomingChannelRegistrations(@NotNull Plugin plugin)
Gets a set containing all the incoming plugin channel registrations
that the specified plugin has.
|
@NotNull Set<PluginMessageListenerRegistration> |
getIncomingChannelRegistrations(@NotNull Plugin plugin,
@NotNull String channel)
Gets a set containing all the incoming plugin channel registrations
that the specified plugin has on the requested channel.
|
@NotNull Set<PluginMessageListenerRegistration> |
getIncomingChannelRegistrations(@NotNull String channel)
Gets a set containing all the incoming plugin channel registrations
that are on the requested channel.
|
@NotNull Set<String> |
getIncomingChannels()
Gets a set containing all the incoming plugin channels.
|
@NotNull Set<String> |
getIncomingChannels(@NotNull Plugin plugin)
Gets a set containing all the incoming plugin channels that the
specified plugin is registered for.
|
@NotNull Set<String> |
getOutgoingChannels()
Gets a set containing all the outgoing plugin channels.
|
@NotNull Set<String> |
getOutgoingChannels(@NotNull Plugin plugin)
Gets a set containing all the outgoing plugin channels that the
specified plugin is registered to.
|
boolean |
isIncomingChannelRegistered(@NotNull Plugin plugin,
@NotNull String channel)
Checks if the specified plugin has registered to receive incoming
messages through the requested channel.
|
boolean |
isOutgoingChannelRegistered(@NotNull Plugin plugin,
@NotNull String channel)
Checks if the specified plugin has registered to send outgoing messages
through the requested channel.
|
boolean |
isRegistrationValid(@NotNull PluginMessageListenerRegistration registration)
Checks if the specified plugin message listener registration is valid.
|
boolean |
isReservedChannel(@NotNull String channel)
Checks if the specified channel is a reserved name.
|
@NotNull PluginMessageListenerRegistration |
registerIncomingPluginChannel(@NotNull Plugin plugin,
@NotNull String channel,
@NotNull PluginMessageListener listener)
Registers the specific plugin for listening on the requested incoming
plugin channel, allowing it to act upon any plugin messages.
|
void |
registerOutgoingPluginChannel(@NotNull Plugin plugin,
@NotNull 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(@NotNull Plugin plugin)
Unregisters the specific plugin from listening on all plugin channels
through all listeners.
|
void |
unregisterIncomingPluginChannel(@NotNull Plugin plugin,
@NotNull 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(@NotNull Plugin plugin,
@NotNull String channel,
@NotNull 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(@NotNull Plugin plugin)
Unregisters the specific plugin from all outgoing plugin channels, no
longer allowing it to send any plugin messages.
|
void |
unregisterOutgoingPluginChannel(@NotNull Plugin plugin,
@NotNull 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(@NotNull @NotNull String channel)
channel
- Channel name to check.IllegalArgumentException
- Thrown if channel is null.void registerOutgoingPluginChannel(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String channel)
plugin
- Plugin that wishes to send messages through the channel.channel
- Channel to register.IllegalArgumentException
- Thrown if plugin or channel is null.void unregisterOutgoingPluginChannel(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String channel)
plugin
- Plugin that no longer wishes to send messages through the
channel.channel
- Channel to unregister.IllegalArgumentException
- Thrown if plugin or channel is null.void unregisterOutgoingPluginChannel(@NotNull @NotNull Plugin plugin)
plugin
- Plugin that no longer wishes to send plugin messages.IllegalArgumentException
- Thrown if plugin is null.@NotNull @NotNull PluginMessageListenerRegistration registerIncomingPluginChannel(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String channel, @NotNull @NotNull PluginMessageListener listener)
plugin
- Plugin that wishes to register to this channel.channel
- Channel to register.listener
- Listener to receive messages on.IllegalArgumentException
- Thrown if plugin, channel or listener
is null, or the listener is already registered for this channel.void unregisterIncomingPluginChannel(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String channel, @NotNull @NotNull PluginMessageListener listener)
plugin
- Plugin that wishes to unregister from this channel.channel
- Channel to unregister.listener
- Listener to stop receiving messages on.IllegalArgumentException
- Thrown if plugin, channel or listener
is null.void unregisterIncomingPluginChannel(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String channel)
plugin
- Plugin that wishes to unregister from this channel.channel
- Channel to unregister.IllegalArgumentException
- Thrown if plugin or channel is null.void unregisterIncomingPluginChannel(@NotNull @NotNull Plugin plugin)
plugin
- Plugin that wishes to unregister from this channel.IllegalArgumentException
- Thrown if plugin is null.@NotNull @NotNull Set<String> getOutgoingChannels()
@NotNull @NotNull Set<String> getOutgoingChannels(@NotNull @NotNull Plugin plugin)
plugin
- Plugin to retrieve channels for.IllegalArgumentException
- Thrown if plugin is null.@NotNull @NotNull Set<String> getIncomingChannels()
@NotNull @NotNull Set<String> getIncomingChannels(@NotNull @NotNull Plugin plugin)
plugin
- Plugin to retrieve channels for.IllegalArgumentException
- Thrown if plugin is null.@NotNull @NotNull Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(@NotNull @NotNull Plugin plugin)
plugin
- Plugin to retrieve registrations for.IllegalArgumentException
- Thrown if plugin is null.@NotNull @NotNull Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(@NotNull @NotNull String channel)
channel
- Channel to retrieve registrations for.IllegalArgumentException
- Thrown if channel is null.@NotNull @NotNull Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String channel)
plugin
- Plugin to retrieve registrations for.channel
- Channel to filter registrations by.IllegalArgumentException
- Thrown if plugin or channel is null.boolean isRegistrationValid(@NotNull @NotNull 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(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String channel)
plugin
- Plugin to check registration for.channel
- Channel to test for.boolean isOutgoingChannelRegistered(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String channel)
plugin
- Plugin to check registration for.channel
- Channel to test for.void dispatchIncomingMessage(@NotNull @NotNull Player source, @NotNull @NotNull String channel, @NotNull @NotNull byte[] message)
source
- Source of the message.channel
- Channel that the message was sent by.message
- Raw payload of the message.Copyright © 2021. All rights reserved.