Python: Use a higher protocol number to get the gradient motd.
Proposed Changes
- Python: When performing a json query, send a higher protocol number to get the motd data (e.g. MiniMotd) that contains the correct gradient.
:white_check_mark: Build minestat 1.0.0.505 completed (commit https://github.com/FragLand/minestat/commit/3dea70f941 by @)
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
Sounds initally like a good idea, if older servers behave correctly with protocol versions above their own. This would need to be tested (and also how the other MC server implementations handle this, like Sponge, Bukkit/Spigot/PaperMC) and esp. servers with ViaVersion.
This modification only affects Java servers. From the documentation, the change in this protocol number does not affect the integrity of the query results.
From the documentation, the change in this protocol number does not affect the integrity of the query results
That might be correct, but better check to make sure. Especially with so many server implementations, mods and vendors :wink:
So I've tested the change with the following servers:
- Vanilla 1.8.9
- Vanilla 1.9
- Vanilla 1.19.3
- Forge 1.19.2
- SpongeVanilla 1.19.3 (API10)
- Velocity 3.1.2
- Two servers with ViaVersion installed
- flying squid (PrismarineJS) 1.11.0 (MC 1.8-1.21)
And everything looks good :) But I was unable to see the problem you mentioned - something about gradients in the MOTD? Could you - just for quickly cross-checking - provide a example for this.
Thanks & BR
For example, on a java server with MiniMOTD installed, if a gradient color is used, MiniMOTD will return a MOTD message that does not contain a gradient to clients with a lower version than the current server.
References from: https://www.spigotmc.org/resources/minimotd-server-list-motd-plugin-with-rgb-gradients.81254/
- Downsample RGB Colors for outdated client.
This means: For clients prior to version 1.16, the RGB color is automatically replaced with the closest color to the original color.
This is because versions of Minecraft below 1.16 do not support RGB colors.
MiniMOTD identifies the client version by the protocol number sent by the client, if the value sent is -1, the client will be considered the old version, so it will not be able to get the MOTD containing rgb color.
In fact, this should be an optional parameter for the user to pass in an arbitrary protocol number. But since I couldn't find the calculation of the protocol number packet in https://minecraft.wiki/w/Java_Edition_protocol/Packets , I had to use the fixed example 25565.
Will this pull request be merged?