类 ServerListPingEvent

所有已实现的接口:
Iterable<Player>

public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
当收到MOTD请求时被调用。显示的玩家会被检查并会在这个事件里被iterating移出。
注意: 如果 Bukkit.getHideOnlinePlayers() 为 true, 则在 iterator() 内的玩家不会被展示到 motd 信息上.
  • 构造器详细资料

  • 方法详细资料

    • getHostname

      @NotNull public @NotNull String getHostname()
      获取玩家连接服务器时使用的主机名,若未知则为空字符串。

      原文:Gets the hostname that the player used to connect to the server, or blank if unknown.

      返回:
      主机名
    • getAddress

      @NotNull public @NotNull InetAddress getAddress()
      获取请求来源地址.

      原文: Get the address the ping is coming from.

      返回:
      地址
    • getMotd

      @NotNull public @NotNull String getMotd()
      获取每日信息.

      原文: Get the message of the day message.

      返回:
      每日信息
    • setMotd

      public void setMotd(@NotNull @NotNull String motd)
      更改每日信息.

      原文: Change the message of the day message.

      参数:
      motd - 每日信息
    • getNumPlayers

      public int getNumPlayers()
      获取玩家数量.

      原文: Get the number of players sent.

      返回:
      玩家数量
    • getMaxPlayers

      public int getMaxPlayers()
      获取最大玩家数量.

      原文: Get the maximum number of players sent.

      返回:
      最大玩家数量
    • shouldSendChatPreviews

      @Deprecated(since="1.19.3") public boolean shouldSendChatPreviews()
      已过时。
      聊天预览已被移除
      获取服务器是否需要向客户端发送聊天预览。

      原文:Gets whether the server needs to send a preview of the chat to the client.

      返回:
      如果聊天预览已启用则为true,否则为false
    • setMaxPlayers

      public void setMaxPlayers(int maxPlayers)
      设置最大玩家数量.

      原文: Set the maximum number of players sent.

      参数:
      maxPlayers - 最大玩家数量
    • setServerIcon

      设置发送给客户端的服务器图标.

      原文: Sets the server-icon sent to the client.

      参数:
      icon - 发送给客户端的图标
      抛出:
      IllegalArgumentException - 如果CachedServerIcon在这个事件中未被调用者创建则抛出错误;一些接口可能会接受null
      UnsupportedOperationException - 如果这个事件的调用者不支持设置这个服务器图标则抛出错误
    • getHandlers

      @NotNull public @NotNull HandlerList getHandlers()
      指定者:
      getHandlers 在类中 Event
    • getHandlerList

      @NotNull public static @NotNull HandlerList getHandlerList()
    • iterator

      调用Iterator.remove()方法将会强制部分玩家不会在玩家列表里显示,减小getNumPlayers()返回的大小,并且不会再被任何一个新的迭代器返回.
      注意: 如果 Bukkit.getHideOnlinePlayers() 为 true, 则在 iterator() 内的玩家不会被展示到 motd 信息上.

      原文:

      Calling the Iterator.remove() method will force that particular player to not be displayed on the player list, decrease the size returned by getNumPlayers(), and will not be returned again by any new iterator.
      Note: The players here will not be shown in the server info if Bukkit.getHideOnlinePlayers() is true.

      指定者:
      iterator 在接口中 Iterable<Player>
      抛出:
      UnsupportedOperationException - 如果这个事件的调用者不支持移除玩家则会抛出错误。