Package kr.toxicity.model.api.nms
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 TypeMethodDescriptionbooleanisEmpty()Checks if the bundler contains no packets.default booleanChecks if the bundler contains at least one packet.default voidsend(@NotNull PlatformPlayer player) Sends all collected packets to the specified player.voidsend(@NotNull PlatformPlayer player, @NotNull Runnable onSuccess) Sends all collected packets to the specified player and executes a callback on success.intsize()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
Sends all collected packets to the specified player.- Parameters:
player- the target player- Since:
- 1.15.2
-
send
Sends all collected packets to the specified player and executes a callback on success.- Parameters:
player- the target playeronSuccess- the callback to run after sending- Since:
- 1.15.2
-