类 StandardMessenger

java.lang.Object
org.bukkit.plugin.messaging.StandardMessenger
所有已实现的接口:
Messenger

public class StandardMessenger extends Object implements Messenger
Messenger的标准实现.
  • 构造器详细资料

    • StandardMessenger

      public StandardMessenger()
  • 方法详细资料

    • isReservedChannel

      public boolean isReservedChannel(@NotNull @NotNull String channel)
      从接口复制的说明: Messenger
      检测指定的通道名称是否为保留名称.
      所有处于"minecraft"命名空间的通道都是被保留的, 除了"minecraft:brand".

      原文:Checks if the specified channel is a reserved name.
      All channels within the "minecraft" namespace except for "minecraft:brand" are reserved.

      指定者:
      isReservedChannel 在接口中 Messenger
      参数:
      channel - 要检测的通道名称
      返回:
      如果这个通道是保留的则为true,反之为false
    • registerOutgoingPluginChannel

      public void registerOutgoingPluginChannel(@NotNull @NotNull Plugin plugin, @NotNull @NotNull 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 - 要注册的通道
    • unregisterOutgoingPluginChannel

      public void unregisterOutgoingPluginChannel(@NotNull @NotNull Plugin plugin, @NotNull @NotNull 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 - 要注销的通道
    • unregisterOutgoingPluginChannel

      public void unregisterOutgoingPluginChannel(@NotNull @NotNull Plugin plugin)
      从接口复制的说明: Messenger
      注销指定插件的所有向外发送插件通道,不再允许它发送任何插件消息.

      原文:Unregisters the specific plugin from all outgoing plugin channels, no longer allowing it to send any plugin messages.

      指定者:
      unregisterOutgoingPluginChannel 在接口中 Messenger
      参数:
      plugin - 不再希望发送插件消息的插件
    • registerIncomingPluginChannel

      从接口复制的说明: 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 - 要接收消息的监听器
      返回:
      注册后的结果(一个对象)
    • unregisterIncomingPluginChannel

      public void unregisterIncomingPluginChannel(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String channel, @NotNull @NotNull 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 - 要停止接收消息的监听器
    • unregisterIncomingPluginChannel

      public void unregisterIncomingPluginChannel(@NotNull @NotNull Plugin plugin, @NotNull @NotNull 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 - 要注销的通道
    • unregisterIncomingPluginChannel

      public void unregisterIncomingPluginChannel(@NotNull @NotNull Plugin plugin)
      从接口复制的说明: Messenger
      注销指定插件在所有监听器上监听的插件通道.

      原文:Unregisters the specific plugin from listening on all plugin channels through all listeners.

      指定者:
      unregisterIncomingPluginChannel 在接口中 Messenger
      参数:
      plugin - 希望注销这些通道的插件
    • getOutgoingChannels

      @NotNull public @NotNull Set<String> getOutgoingChannels()
      从接口复制的说明: Messenger
      获取包含了所有向外发送的插件通道的set集合.

      原文:Gets a set containing all the outgoing plugin channels.

      指定者:
      getOutgoingChannels 在接口中 Messenger
      返回:
      已注册的所有发送插件通道的列表
    • getOutgoingChannels

      @NotNull public @NotNull Set<String> getOutgoingChannels(@NotNull @NotNull Plugin plugin)
      从接口复制的说明: Messenger
      获取一个包含了指定插件注册的全部向外发送的插件通道的set集合.

      原文:Gets a set containing all the outgoing plugin channels that the specified plugin is registered to.

      指定者:
      getOutgoingChannels 在接口中 Messenger
      参数:
      plugin - 要检索通道的插件
      返回:
      所有这个插件注册的正在发送的插件通道的列表
    • getIncomingChannels

      @NotNull public @NotNull Set<String> getIncomingChannels()
      从接口复制的说明: Messenger
      获取包含了所有接收的插件通道的set集合.

      原文:Gets a set containing all the incoming plugin channels.

      指定者:
      getIncomingChannels 在接口中 Messenger
      返回:
      已注册的所有正在接收的插件通道的列表
    • getIncomingChannels

      @NotNull public @NotNull Set<String> getIncomingChannels(@NotNull @NotNull Plugin plugin)
      从接口复制的说明: Messenger
      获取一个包含了指定插件注册的所有接收的插件通道的set集合.

      原文:Gets a set containing all the incoming plugin channels that the specified plugin is registered for.

      指定者:
      getIncomingChannels 在接口中 Messenger
      参数:
      plugin - 要检索通道的插件
      返回:
      所有这个插件注册的正在接收的插件通道的列表
    • getIncomingChannelRegistrations

      @NotNull public @NotNull Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(@NotNull @NotNull Plugin plugin)
      从接口复制的说明: Messenger
      获取一个包含了指定插件拥有的所有接收的插件通道的注册的set集合.

      原文:Gets a set containing all the incoming plugin channel registrations that the specified plugin has.

      指定者:
      getIncomingChannelRegistrations 在接口中 Messenger
      参数:
      plugin - 要检索注册的插件
      返回:
      这个插件注册的所有注册的列表
    • getIncomingChannelRegistrations

      @NotNull public @NotNull Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(@NotNull @NotNull String channel)
      从接口复制的说明: Messenger
      获取一个包含了所有在请求通道上的接收的插件通道的注册的set集合.

      原文:Gets a set containing all the incoming plugin channel registrations that are on the requested channel.

      指定者:
      getIncomingChannelRegistrations 在接口中 Messenger
      参数:
      channel - 要检索注册的通道
      返回:
      在这个通道上注册的所有注册的列表
    • getIncomingChannelRegistrations

      @NotNull public @NotNull Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String channel)
      从接口复制的说明: Messenger
      获取一个包含了指定插件在请求的通道上的所有接收的插件通道的注册的set集合.

      原文:Gets a set containing all the incoming plugin channel registrations that the specified plugin has on the requested channel.

      指定者:
      getIncomingChannelRegistrations 在接口中 Messenger
      参数:
      plugin - 要检索注册的插件
      channel - 由某个通道过滤注册
      返回:
      这个插件拥有的所有注册的列表
    • isRegistrationValid

      public boolean isRegistrationValid(@NotNull @NotNull 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 - 要检测的注册
      返回:
      如果注册是有效的则为true,false反之
    • isIncomingChannelRegistered

      public boolean isIncomingChannelRegistered(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String channel)
      从接口复制的说明: Messenger
      检测指定插件注册的传入的消息是否通过了请求的通道.

      译注:按方法名来看,应该是检测指定正在接收的通道是否在这个插件上注册过.

      原文:Checks if the specified plugin has registered to receive incoming messages through the requested channel.

      指定者:
      isIncomingChannelRegistered 在接口中 Messenger
      参数:
      plugin - 要检测注册的插件
      channel - 要检测的通道
      返回:
      如果通道已注册则为true,false反之
    • isOutgoingChannelRegistered

      public boolean isOutgoingChannelRegistered(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String channel)
      从接口复制的说明: Messenger
      检测指定插件注册的发送的消息是否通过了请求的通道.

      译注:按方法名来看,应该是检测指定正在发送的通道是否在这个插件上注册过.

      原文:Checks if the specified plugin has registered to send outgoing messages through the requested channel.

      指定者:
      isOutgoingChannelRegistered 在接口中 Messenger
      参数:
      plugin - 要检测注册的插件
      channel - 要检测的通道
      返回:
      如果通道已注册则为true,false反之
    • dispatchIncomingMessage

      public void dispatchIncomingMessage(@NotNull @NotNull Player source, @NotNull @NotNull String channel, @NotNull @org.jetbrains.annotations.NotNull byte[] message)
      从接口复制的说明: Messenger
      调度指定接收消息的任何注册过的监听器.

      原文:Dispatches the specified incoming message to any registered listeners.

      指定者:
      dispatchIncomingMessage 在接口中 Messenger
      参数:
      source - 消息源
      channel - 通过什么通道发送的消息
      message - 消息的原始有效载荷
    • validateChannel

      @Deprecated(since="1.13") public static void validateChannel(@NotNull @NotNull String channel)
      已过时。
      不是一个 API 方法
      验证插件通道名称。

      原文:Validates a Plugin Channel name.

      参数:
      channel - 要验证的通道名称。
    • validateAndCorrectChannel

      @Deprecated(since="1.13") @NotNull public static @NotNull String validateAndCorrectChannel(@NotNull @NotNull String channel)
      已过时。
      不是一个 API 方法
      验证并修正插件通道名称。该方法不是可重入的/幂等的。

      原文:Validates and corrects a Plugin Channel name. Method is not reentrant / idempotent.

      参数:
      channel - 要验证的通道名称。
      返回:
      修正后的通道名称
    • validatePluginMessage

      public static void validatePluginMessage(@NotNull @NotNull Messenger messenger, @NotNull @NotNull Plugin source, @NotNull @NotNull String channel, @NotNull @org.jetbrains.annotations.NotNull byte[] message)
      验证插件消息的输入,确保所有参数有效。

      原文:Validates the input of a Plugin Message, ensuring the arguments are all valid.

      参数:
      messenger - 用于验证的 Messenger。
      source - 消息的源插件。
      channel - 发送消息的插件通道。
      message - 要发送的原始消息负载。
      抛出:
      IllegalArgumentException - 如果源插件被禁用则抛出。
      IllegalArgumentException - 如果 source、channel 或 message 为 null 则抛出。
      MessageTooLargeException - 如果消息过大则抛出。
      ChannelNameTooLongException - 如果通道名称过长则抛出。
      ChannelNotRegisteredException - 如果该插件未注册该通道则抛出。