ProtocolLib

3M Downloads

Synchronizing PacketReceiving and PacketSending

constantins2001 opened this issue ยท 0 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
Is it possible to synchronize the receiving and sending listeners so that all packets (for the same player) are in absolute order?

API method(s) used
onPacketReceiving
onPacketSending

Expected behavior
Packets from the same player are in absolute order

Code
If applicable, add relevant code from your project

Additional context
I currently have the problem that if the player's move event is influenced by a serverside packet like EntityVelocity, the EntityVelocity packet is sometimes offset by 1 or more packets (into the future) from the move event which was affected by the packet.
That behavior makes sense since sending/receiving isn't synchronized, but is there a way to restore the original order?

Example of the expected behavior:
Client -> Server: POSITION PACKET
Client -> Server: POSITION PACKET
Client -> Server: POSITION PACKET
Client <- Server: ENTITY_VELOCITY
Client -> Server: POSITION PACKET
Client -> Server: POSITION PACKET
Client -> Server: POSITION PACKET
...

Real behavior (only sometimes, most of the time expected):
Client -> Server: POSITION PACKET
Client -> Server: POSITION PACKET
Client -> Server: POSITION PACKET
Client -> Server: POSITION PACKET
Client <- Server: ENTITY_VELOCITY
Client -> Server: POSITION PACKET
Client -> Server: POSITION PACKET
...