接口 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 pointdefault 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
broadcastAll
(CustomPacketPayload payload) Sends a payload to all players on the serverdefault void
broadcastAll
(CustomPacketPayload payload, ResourceKey<Level> targetLevel) Sends a payload to all players within the specific level.default PlayerList
self()
返回 the PlayerList instance that this extension is attached to。
-
方法详细资料
-
self
返回 the PlayerList instance that this extension is attached to。- 返回:
- the PlayerList instance that this extension is attached to
-
broadcastAll
Sends a payload to all players on the server- 参数:
payload
- the payload to send
-
broadcastAll
Sends a payload to all players within the specific level.- 参数:
payload
- the payload to sendtargetLevel
- 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 pointy
- the y coordinate of the target pointz
- the z coordinate of the target pointrange
- the range around the target point to send the payload tolevel
- the level to send the payload topayload
- 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 pointy
- the y coordinate of the target pointz
- the z coordinate of the target pointrange
- the range around the target point to send the payload tolevel
- the level to send the payload topayload
- the payload to send
-