ProtocolLib

3M Downloads

Are packets sent asynchronously guaranteed to be sent to the player in the correct order?

LOOHP opened this issue ยท 3 comments

commented

Make sure you're doing the following

  • You're using the latest build for your server version
  • This isn't an issue caused by another plugin
  • You've checked for duplicate issues
  • You didn't use /reload

Describe the question
Quick question, are packets sent using the method below asynchronously guaranteed to be sent to the player in the correct order?
Namely entity packets, like LivingEntity spawn packets or Entity Metadata, as well as Chat Packets.

API method(s) used
ProtocolManager.sendServerPacket(Player player, PacketContainer packet, boolean filter);

commented

you might be able to ensure the order by scheduling them all on the channel thread. but order is very much not guaranteed async

commented

Like if I send all my packets on the same async thread, the order is still not guaranteed?

commented

if they're all sent on the same thread, they should arrive in the same order relative to each other. can't make any guarantees about other packets though