Minecrell / ServerListPlus

A flexible Minecraft plugin to customize the appearance of your server in the server list
https://git.io/slp
GNU General Public License v3.0
240 stars 58 forks source link

3.5.0 - Standalone server does not recognize the 'Slots' property #387

Closed Darkhand81 closed 2 years ago

Darkhand81 commented 2 years ago

Hello!

When trying to customize the slots section, I found that the standalone server cannot interpret the Slots property for customizing the text of the player slot section in the Minecraft client:

Error

I'm looking to use the standalone server as a placeholder while the Minecraft process is down for maintenance, and display 'Maintenance' in that section, but the standalone server displays the default 'ServerListPlus':

Error

Perhaps I'm misconfiguring? The relevant section of the config is here:

--- !Status
Default:
  Description:
  - |-
    &eWelcome!!
    &cCurrently down for maintenance. Come back soon!
  Players:
    Slots:
    - 'Maintenance'
    Hover:
    - |-
      &cWe are currently doing maintenance on our server.
      &ePlease try again later! :)

Thanks so much for this great feature! The standalone server is invaluable.

stephan-gh commented 2 years ago

For the SLPServer you probably want the "Outdated Version" option instead: https://github.com/Minecrell/ServerListPlus/wiki/Status-Configuration#outdated-version

The slots feature is similar (and closely related), but is only triggered if the client and server are running compatible Minecraft versions.

Darkhand81 commented 2 years ago

That is indeed the issue! My mistake. :) Now that I look at the actual data that gets sent in both instances, I'm assuming one can't use the current protocol and a name at the same time, because when using the modern protocol, the client is looking for numeric values for the players/max and players/online entries in the json that gets sent?

Either way, thanks so much for still technically supporting this great plugin/standalone server in the face of the Log4j issues, bugfixes, etc. It's very much appreciated!

stephan-gh commented 2 years ago

Now that I look at the actual data that gets sent in both instances, I'm assuming one can't use the current protocol and a name at the same time, because when using the modern protocol, the client is looking for numeric values for the players/max and players/online entries in the json that gets sent?

A typical JSON response will look like (from wiki.vg: https://wiki.vg/Server_List_Ping#Response):

{
    "description": {
        "text": "Hello world"
    },
    "players": {
        "online": 5,
        "max": 100,
    },
    "version": {
        "name": "ServerListPlus",
        "protocol": 47
    },
}

The online/max count is always numeric. However, the client won't display the player count in the server list if the (server) version.protocol is incompatible with the client protocol version. In that case the version "name" will be shown using red text in place of the player slots.

Unless you configure a protocol version (see https://github.com/Minecrell/ServerListPlus/wiki/Standalone-Server#minecraft-version), the SLP standalone server will always display as incompatible on the client. Therefore, it will always show the version "name" and not the online/max count.

The player Slots option in SLP is a big hack that abuses the version "name": If SLP detects that the client and server are using compatible protocol versions, it sends a fake protocol version and places the custom text in the version "name". Then the same happens as for the SLP server - the client detects an incompatible server and displays the version "name", which happens to contain the custom player slots text. e.g.

{
    "description": {
        "text": "Hello world"
    },
    "players": {
        "online": 0,
        "max": 10,
    },
    "version": {
        "name": "0/10 players are online!!!",
        "protocol": 999
    },
}