Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query protocol fixes #146

Closed
wants to merge 4 commits into from
Closed

Query protocol fixes #146

wants to merge 4 commits into from

Conversation

py-mine-bot
Copy link
Collaborator

MeRuslan Authored by MeRuslan
Jun 21, 2021
Merged 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

@py-mine-bot
Copy link
Collaborator Author

kevinkjt2000 Authored by kevinkjt2000
Jun 21, 2021


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.

@py-mine-bot
Copy link
Collaborator Author

MeRuslan Authored by MeRuslan
Jun 21, 2021


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

@py-mine-bot
Copy link
Collaborator Author

kevinkjt2000 Authored by kevinkjt2000
Jun 21, 2021


Released in v6.1.2
Thanks for the contribution ❤️

@py-mine-bot
Copy link
Collaborator Author

MeRuslan Authored by MeRuslan
Jun 21, 2021


Thanks for a prompt review.

@py-mine-bot py-mine-bot added the Github Import This was auto-imported from upstream repository label Feb 17, 2022
@py-mine-bot py-mine-bot deleted the pr146head branch February 17, 2022 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Github Import This was auto-imported from upstream repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants