Skip to content

Conversation

@molanp
Copy link

@molanp molanp commented Mar 23, 2025

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.

@AppVeyorBot
Copy link

Build minestat 1.0.0.505 completed (commit 3dea70f941 by @)

@sonarqubecloud
Copy link

@mindsolve
Copy link
Collaborator

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.

@molanp
Copy link
Author

molanp commented Mar 26, 2025

This modification only affects Java servers. From the documentation, the change in this protocol number does not affect the integrity of the query results.

@mindsolve
Copy link
Collaborator

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 😉

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

@molanp
Copy link
Author

molanp commented Apr 22, 2025

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.

@molanp
Copy link
Author

molanp commented May 4, 2025

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.

@molanp
Copy link
Author

molanp commented Oct 1, 2025

Will this pull request be merged?

@AppVeyorBot
Copy link

Build minestat 1.0.0.516 completed (commit 350363f345 by @molanp)

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@molanp
Copy link
Author

molanp commented Nov 28, 2025

Ok, now I'm using the correct protocol version 1.21.10(773)

Setting invalid (nonexistent) version as the protocol version might cause some servers to close connection after this packet

ref: https://minecraft.wiki/w/Java_Edition_protocol/Server_List_Ping

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.

3 participants