retrooper / packetevents

Precision meets performance—a powerful tool for mastering Minecraft packet manipulation with speed and finesse.
GNU General Public License v3.0
563 stars 151 forks source link

Outgoing event is null? User is in HANDSHAKING state, but the server already wants to send a packet to them? #240

Closed MWHunter closed 2 years ago

MWHunter commented 2 years ago

https://gist.githubusercontent.com/MWHunter/a32e9f80ba8caa7da1d61c9dc650ee38/raw/8959e87ebd7df6c02cf993d472529b90717c9f4b/gistfile1.txt

I don't know why this happened.

retrooper commented 2 years ago

Still?

MWHunter commented 2 years ago

Yes

retrooper commented 2 years ago

Any consistency?

MWHunter commented 2 years ago

not really. It happens on the test server a lot when no one is online.

retrooper commented 2 years ago

I worked around with some stuff, lets see if this fixes itself.

MWHunter commented 2 years ago

this isn't fixed

ghost commented 2 years ago

event != null easy fix?

retrooper commented 2 years ago

I don't want to risk losing early packets.

retrooper commented 2 years ago

Trying to understand the underlying cause.

MWHunter commented 2 years ago

My guess is that it has something to do with the query protocol. There's no debug messages from a player ever handshaking and there is no one online. This is just a wild guess though.

MWHunter commented 2 years ago

Connecting with beta 1.7.3 will cause event to be null. This reproduces consistently 100% of the time.

retrooper commented 2 years ago

Perfect, will help me look into this. My assumption is it has something to do with the LEGACY SERVER LIST PING packet.

MWHunter commented 2 years ago

Still an issue: https://sentry.io/share/issue/dc1c76685b36403abe35a336731b256f/

retrooper commented 2 years ago

Are you still testing with 1.7.3?

MWHunter commented 2 years ago

Minecraft release 1.6.4 also causes the exception to be thrown

ghost commented 2 years ago

define doing a lil bit of trollin

MWHunter commented 2 years ago

This seems to be fixed after ignoring the legacy ping packets and waiting until play state before allowing transactions to be sent. Perhaps add a warning so other packetevents user's don't make the same mistake I did

MWHunter commented 2 years ago

Still an issue when a pre-1.7 player tries to connect

MWHunter commented 2 years ago

Finally got annoyed enough to add a handshake send event Fixed in https://github.com/retrooper/packetevents/commit/70dc93cd09d6314143a17740bd251ad74c52987c

The server sends a raw byte buffer in the old format during the handshaking state to respond to the ping, and then kills the client's connection. So this isn't a hack and is actually correct.