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 Type
    Method
    Description
    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
    Returns the PlayerList instance that this extension is attached to.
  • Method Details

    • self

      default PlayerList self()
      Returns the PlayerList instance that this extension is attached to.
      Returns:
      the PlayerList instance that this extension is attached to
    • broadcastAll

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

      default void broadcastAll(CustomPacketPayload payload, ResourceKey<Level> targetLevel)
      Sends a payload to all players within the specific level.
      Parameters:
      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
      Parameters:
      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.
      Parameters:
      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