MAX_CHANNEL_SIZE, MAX_MESSAGE_SIZE
构造器和说明 |
---|
StandardMessenger() |
限定符和类型 | 方法和说明 |
---|---|
void |
dispatchIncomingMessage(Player source,
java.lang.String channel,
byte[] message)
调度指定接收消息的任何注册过的监听器.
|
java.util.Set<PluginMessageListenerRegistration> |
getIncomingChannelRegistrations(Plugin plugin)
获取一个包含了指定插件拥有的所有接收的插件通道的注册的set集合.
|
java.util.Set<PluginMessageListenerRegistration> |
getIncomingChannelRegistrations(Plugin plugin,
java.lang.String channel)
获取一个包含了指定插件在请求的通道上的所有接收的插件通道的注册的set集合.
|
java.util.Set<PluginMessageListenerRegistration> |
getIncomingChannelRegistrations(java.lang.String channel)
获取一个包含了所有在请求通道上的接收的插件通道的注册的set集合.
|
java.util.Set<java.lang.String> |
getIncomingChannels()
获取包含了所有接收的插件通道的set集合.
|
java.util.Set<java.lang.String> |
getIncomingChannels(Plugin plugin)
获取一个包含了指定插件注册的所有接收的插件通道的set集合.
|
java.util.Set<java.lang.String> |
getOutgoingChannels()
获取包含了所有向外发送的插件通道的set集合.
|
java.util.Set<java.lang.String> |
getOutgoingChannels(Plugin plugin)
获取一个包含了指定插件注册的全部向外发送的插件通道的set集合.
|
boolean |
isIncomingChannelRegistered(Plugin plugin,
java.lang.String channel)
检测指定插件注册的传入的消息是否通过了请求的通道.
|
boolean |
isOutgoingChannelRegistered(Plugin plugin,
java.lang.String channel)
检测指定插件注册的发送的消息是否通过了请求的通道.
|
boolean |
isRegistrationValid(PluginMessageListenerRegistration registration)
检测指定插件消息监听器的注册是否有效.
|
boolean |
isReservedChannel(java.lang.String channel)
检测指定的通道名称是否为保留名称.
|
PluginMessageListenerRegistration |
registerIncomingPluginChannel(Plugin plugin,
java.lang.String channel,
PluginMessageListener listener)
注册指定的监听指定的接收的插件通道的插件,允许它在任何插件消息上做动作.
|
void |
registerOutgoingPluginChannel(Plugin plugin,
java.lang.String channel)
注册指定插件所请求的发送插件通道,允许它通过这个通道向任何客户端发送消息.
|
void |
unregisterIncomingPluginChannel(Plugin plugin)
注销指定插件在所有监听器上监听的插件通道.
|
void |
unregisterIncomingPluginChannel(Plugin plugin,
java.lang.String channel)
注销指定插件请求的监听的接收的插件通道,不再允许它在任何插件消息上做动作.
|
void |
unregisterIncomingPluginChannel(Plugin plugin,
java.lang.String channel,
PluginMessageListener listener)
注销指定插件请求的监听接收的插件通道的监听器,不再允许它在任何插件消息上做任何动作.
|
void |
unregisterOutgoingPluginChannel(Plugin plugin)
注销指定插件的所有向外发送插件通道,不再允许它发送任何插件消息.
|
void |
unregisterOutgoingPluginChannel(Plugin plugin,
java.lang.String channel)
注销指定插件请求的插件发送通道,不再允许它通过这个通道发送消息到任何客户端.
|
static void |
validateChannel(java.lang.String channel)
Validates a Plugin Channel name.
|
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
原文:Checks if the specified channel is a reserved name.
isReservedChannel
在接口中 Messenger
channel
- 要检测的通道名称public void registerOutgoingPluginChannel(Plugin plugin, java.lang.String channel)
Messenger
原文:Registers the specific plugin to the requested outgoing plugin channel, allowing it to send messages through that channel to any clients.
registerOutgoingPluginChannel
在接口中 Messenger
plugin
- 希望通过该通过发送消息的插件channel
- 要注册的通道public void unregisterOutgoingPluginChannel(Plugin plugin, java.lang.String channel)
Messenger
原文:Unregisters the specific plugin from the requested outgoing plugin channel, no longer allowing it to send messages through that channel to any clients.
unregisterOutgoingPluginChannel
在接口中 Messenger
plugin
- 不再希望通过此通道发送消息的插件channel
- 要注销的通道public void unregisterOutgoingPluginChannel(Plugin plugin)
Messenger
原文:Unregisters the specific plugin from all outgoing plugin channels, no longer allowing it to send any plugin messages.
unregisterOutgoingPluginChannel
在接口中 Messenger
plugin
- 不再希望发送插件消息的插件public PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, java.lang.String channel, PluginMessageListener listener)
Messenger
原文:Registers the specific plugin for listening on the requested incoming plugin channel, allowing it to act upon any plugin messages.
registerIncomingPluginChannel
在接口中 Messenger
plugin
- 希望注册这个通道的插件channel
- 要注册的通道listener
- 要接收消息的监听器public void unregisterIncomingPluginChannel(Plugin plugin, java.lang.String channel, PluginMessageListener listener)
Messenger
原文:Unregisters the specific plugin's listener from listening on the requested incoming plugin channel, no longer allowing it to act upon any plugin messages.
unregisterIncomingPluginChannel
在接口中 Messenger
plugin
- 希望注销这个通道的插件channel
- 要注销的通道listener
- 要停止接收消息的监听器public void unregisterIncomingPluginChannel(Plugin plugin, java.lang.String channel)
Messenger
原文:Unregisters the specific plugin from listening on the requested incoming plugin channel, no longer allowing it to act upon any plugin messages.
unregisterIncomingPluginChannel
在接口中 Messenger
plugin
- 希望注销这个通道的插件channel
- 要注销的通道public void unregisterIncomingPluginChannel(Plugin plugin)
Messenger
原文:Unregisters the specific plugin from listening on all plugin channels through all listeners.
unregisterIncomingPluginChannel
在接口中 Messenger
plugin
- 希望注销这些通道的插件public java.util.Set<java.lang.String> getOutgoingChannels()
Messenger
原文:Gets a set containing all the outgoing plugin channels.
getOutgoingChannels
在接口中 Messenger
public java.util.Set<java.lang.String> getOutgoingChannels(Plugin plugin)
Messenger
原文:Gets a set containing all the outgoing plugin channels that the specified plugin is registered to.
getOutgoingChannels
在接口中 Messenger
plugin
- 要检索通道的插件public java.util.Set<java.lang.String> getIncomingChannels()
Messenger
原文:Gets a set containing all the incoming plugin channels.
getIncomingChannels
在接口中 Messenger
public java.util.Set<java.lang.String> getIncomingChannels(Plugin plugin)
Messenger
原文:Gets a set containing all the incoming plugin channels that the specified plugin is registered for.
getIncomingChannels
在接口中 Messenger
plugin
- 要检索通道的插件public java.util.Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(Plugin plugin)
Messenger
原文:Gets a set containing all the incoming plugin channel registrations that the specified plugin has.
getIncomingChannelRegistrations
在接口中 Messenger
plugin
- 要检索注册的插件public java.util.Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(java.lang.String channel)
Messenger
原文:Gets a set containing all the incoming plugin channel registrations that are on the requested channel.
getIncomingChannelRegistrations
在接口中 Messenger
channel
- 要检索注册的通道public java.util.Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(Plugin plugin, java.lang.String channel)
Messenger
原文:Gets a set containing all the incoming plugin channel registrations that the specified plugin has on the requested channel.
getIncomingChannelRegistrations
在接口中 Messenger
plugin
- 要检索注册的插件channel
- 由某个通道过滤注册public boolean isRegistrationValid(PluginMessageListenerRegistration registration)
Messenger
如果它没有注册以及插件仍然启用,那么注册就是有效的.
原文:Checks if the specified plugin message listener registration is valid.
A registration is considered valid if it has not be unregistered and that the plugin is still enabled.
isRegistrationValid
在接口中 Messenger
registration
- 要检测的注册public boolean isIncomingChannelRegistered(Plugin plugin, java.lang.String channel)
Messenger
译注:按方法名来看,应该是检测指定正在接收的通道是否在这个插件上注册过.
原文:Checks if the specified plugin has registered to receive incoming messages through the requested channel.
isIncomingChannelRegistered
在接口中 Messenger
plugin
- 要检测注册的插件channel
- 要检测的通道public boolean isOutgoingChannelRegistered(Plugin plugin, java.lang.String channel)
Messenger
译注:按方法名来看,应该是检测指定正在发送的通道是否在这个插件上注册过.
原文:Checks if the specified plugin has registered to send outgoing messages through the requested channel.
isOutgoingChannelRegistered
在接口中 Messenger
plugin
- 要检测注册的插件channel
- 要检测的通道public void dispatchIncomingMessage(Player source, java.lang.String channel, byte[] message)
Messenger
原文:Dispatches the specified incoming message to any registered listeners.
dispatchIncomingMessage
在接口中 Messenger
source
- 消息源channel
- 通过什么通道发送的消息message
- 消息的原始有效载荷public static void validateChannel(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.