Skip to content

Conversation

@MeRuslan
Copy link
Contributor

@MeRuslan MeRuslan commented Jun 21, 2021

This library seems to not conform to minecraft query protocol.

This PR fixes inconsistencies and cleans up query packet handling. Tests are provided.

It now queries PocketMine-MP servers, as well as regular java edition servers.
Closes #145, properly.

Details on fixes (from https://wiki.vg/Query which seems to be the closest to the truth on minecraft protocol):

  1. There was an extra zero int written to the handshake packet, now it conforms to this:
    image

  2. Cleaned up request packet generation as well, it all is now handled in one place, rather than doing most of the work in a single method and then adding a padding. It conforms to this:
    image
    Functionally not a lot changes.

  3. Querier now generates proper session ids instead of always using 0, which helps readability and is more correct.
    GameSpot) Query Protocol
    image

@MeRuslan MeRuslan changed the title Protocol fixes Query protocol fixes Jun 21, 2021
@kevinkjt2000 kevinkjt2000 self-requested a review June 21, 2021 13:15
@kevinkjt2000
Copy link
Collaborator

Thanks for the pull request! And nice catch!

As stated the magic number seems to be missing at the start of the handshake packet. It seems the vanilla server has handled this without any issue for a long time, so I'll have to do some thorough testing/review to make sure the existing behavior continues to function.

@MeRuslan
Copy link
Contributor Author

No, magic number was always there.
The issue was an extra 0 in a handshake packet.

@kevinkjt2000 kevinkjt2000 merged commit e563177 into Dinnerbone:master Jun 21, 2021
@kevinkjt2000
Copy link
Collaborator

Released in v6.1.2
Thanks for the contribution ❤️

@MeRuslan
Copy link
Contributor Author

Thanks for a prompt review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't get response from a server

2 participants