Interface IPlayerListExtension
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.
-
Method Summary
Modifier and TypeMethodDescriptiondefault 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()
Returns the PlayerList instance that this extension is attached to.
-
Method Details
-
self
Returns the PlayerList instance that this extension is attached to.- Returns:
- the PlayerList instance that this extension is attached to
-
broadcastAll
Sends a payload to all players on the server- Parameters:
payload
- the payload to send
-
broadcastAll
Sends a payload to all players within the specific level.- Parameters:
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- Parameters:
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.- Parameters:
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
-