Prevent invalid status responses with empty/dummy player UUIDs #3831
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Right now
SpongeGameProfile.toMcProfile()
converts all SpongeAPIGameProfile
s with empty UUIDs (= new UUID(0, 0)
) to authlibGameProfile
s with a null UUID.This is fine in most cases but problematic for the sample/player list in the status response. Empty UUIDs can be used there to create dummy entries, to display custom messages in the server list instead of the online players. (See e.g. https://github.com/Minecrell/ServerListPlus/wiki/Status-Configuration#player-hover-messages)
The Minecraft client completely rejects status responses that contain GameProfiles with null UUIDs and/or null names. This is why it is important that the empty UUID is not converted to a null UUID.
[Client thread/ERROR]: Can't ping localhost: Internal Exception: io.netty.handler.codec.DecoderException: java.lang.IllegalArgumentException: Invalid UUID string:
Prevent sending invalid responses to the client by making sure both UUID and name are non-null in the player samples of the status response.
This fixes a regression in API 8 when using the ServerListPlus plugin on Sponge. The problem was likely introduced in some
GameProfile
refactoring (API 7 worked fine).There is similar code in Paper to avoid this problem: https://github.com/PaperMC/Paper/blob/ad3e1bc12104f1f8ea8bcf9248a606133bfc7780/patches/server/0182-Implement-extended-PaperServerListPingEvent.patch#L122-L128
I would appreciate if you could pick/merge this into all newer branches as well, not sure how Sponge development works nowadays :)