minestat icon indicating copy to clipboard operation
minestat copied to clipboard

Python: Use a higher protocol number to get the gradient motd.

Open molanp opened this issue 9 months ago • 11 comments

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.

molanp avatar Mar 23 '25 01:03 molanp

:white_check_mark: Build minestat 1.0.0.505 completed (commit https://github.com/FragLand/minestat/commit/3dea70f941 by @)

AppVeyorBot avatar Mar 23 '25 01:03 AppVeyorBot

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.

mindsolve avatar Mar 26 '25 14:03 mindsolve

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

molanp avatar Mar 26 '25 14:03 molanp

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

mindsolve avatar Apr 20 '25 20:04 mindsolve

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 avatar Apr 22 '25 14:04 molanp

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 avatar May 04 '25 17:05 molanp

Will this pull request be merged?

molanp avatar Oct 01 '25 08:10 molanp