Interface PacketBundler


public interface PacketBundler
Collects multiple packets to be sent together to a player.

This helps optimize network traffic by grouping related updates (e.g., bone movements) into a single bundle or batch.

Since:
1.15.2
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if the bundler contains no packets.
    default boolean
    Checks if the bundler contains at least one packet.
    default void
    send(@NotNull PlatformPlayer player)
    Sends all collected packets to the specified player.
    void
    send(@NotNull PlatformPlayer player, @NotNull Runnable onSuccess)
    Sends all collected packets to the specified player and executes a callback on success.
    int
    Returns the number of packets in the bundler.
  • Method Details

    • isEmpty

      boolean isEmpty()
      Checks if the bundler contains no packets.
      Returns:
      true if empty, false otherwise
      Since:
      1.15.2
    • isNotEmpty

      default boolean isNotEmpty()
      Checks if the bundler contains at least one packet.
      Returns:
      true if not empty, false otherwise
      Since:
      1.15.2
    • size

      int size()
      Returns the number of packets in the bundler.
      Returns:
      the packet count
      Since:
      1.15.2
    • send

      default void send(@NotNull @NotNull PlatformPlayer player)
      Sends all collected packets to the specified player.
      Parameters:
      player - the target player
      Since:
      1.15.2
    • send

      void send(@NotNull @NotNull PlatformPlayer player, @NotNull @NotNull Runnable onSuccess)
      Sends all collected packets to the specified player and executes a callback on success.
      Parameters:
      player - the target player
      onSuccess - the callback to run after sending
      Since:
      1.15.2