接口 IPlayerListExtension

所有已知实现类:
DedicatedPlayerList, PlayerList

public interface IPlayerListExtension
Extension class for PlayerList

This interface with its default methods allows for easy sending of payloads to all, or specific, players on the server.

  • 方法概要

    修饰符和类型
    方法
    说明
    default void
    broadcast(double x, double y, double z, double range, ResourceKey<Level> level, CustomPacketPayload payload)
    Sends a payload to all players within the specific level, within a given range around the target point
    default void
    broadcast(Player excludedPlayer, double x, double y, double z, double range, ResourceKey<Level> level, CustomPacketPayload payload)
    Sends a payload to all players within the specific level, within a given range around the target point, excluding the specified player.
    default void
    Sends a payload to all players on the server
    default void
    Sends a payload to all players within the specific level.
    default PlayerList
    返回 the PlayerList instance that this extension is attached to。
  • 方法详细资料

    • self

      default PlayerList self()
      返回 the PlayerList instance that this extension is attached to。
      返回:
      the PlayerList instance that this extension is attached to
    • broadcastAll

      default void broadcastAll(CustomPacketPayload payload)
      Sends a payload to all players on the server
      参数:
      payload - the payload to send
    • broadcastAll

      default void broadcastAll(CustomPacketPayload payload, ResourceKey<Level> targetLevel)
      Sends a payload to all players within the specific level.
      参数:
      payload - the payload to send
      targetLevel - the level to send the payload to.
    • broadcast

      default void broadcast(double x, double y, double z, double range, ResourceKey<Level> level, CustomPacketPayload payload)
      Sends a payload to all players within the specific level, within a given range around the target point
      参数:
      x - the x coordinate of the target point
      y - the y coordinate of the target point
      z - the z coordinate of the target point
      range - the range around the target point to send the payload to
      level - the level to send the payload to
      payload - the payload to send
    • broadcast

      default void broadcast(Player excludedPlayer, double x, double y, double z, double range, ResourceKey<Level> level, CustomPacketPayload payload)
      Sends a payload to all players within the specific level, within a given range around the target point, excluding the specified player.
      参数:
      excludedPlayer - the player to exclude from the broadcast, when null all players will receive the payload.
      x - the x coordinate of the target point
      y - the y coordinate of the target point
      z - the z coordinate of the target point
      range - the range around the target point to send the payload to
      level - the level to send the payload to
      payload - the payload to send