ViaVersion
ViaVersion copied to clipboard
Scoreboard score packet translation bug when crossing <1.13 -> 1.13+
/viaversion dump
Output
https://dump.viaversion.com/f1ed970c5ca7277e5923803fbb8dda8b06686a67933f5072d8db65ad2b18e4cb
Console Error
No response
Bug Description
When multiple lines of sidebar have the same score value, they are sorted alphabetically by player names. This can be used to display the same number in all lines (such as 0 or 1) while still having lines in wanted order.
However, when on <1.13 server with 1.13+ client, viaversion somehow breaks this for lines that only have color codes OR lines that don't only have color codes (I don't have the tools to find out which one is true).
Having player names only consist of colors can be used for dynamic text by putting text into prefix and suffix and easily update it without "the flicker effect". Sometimes using text in player name as well can be used to display long static text to avoid the limits on <1.13 as much as possible.
I created simple code that can reproduce this, which can be found at https://pastebin.com/BUwzr1n0.
This is how side bar is supposed to look and does look on <1.13 client on <1.13 server
However, when connecting with 1.13+ client, lines are messed up
When starting a 1.13+ server, it's correct for all clients. I was able to implement a workaround by not putting non-colors into player names for 1.13+ clients since the limit is no longer present, however due to another (I believe) viaversion bug the API rarely returns server's version instead of actual client version when called in PlayerJoinEvent. I asked about this on your discord some time ago, but this didn't lead anywhere.
Steps to Reproduce
- Compile and install plugin with provided code
- Run a <1.13 server with VV
- Connect with 1.13+ client, you can also connect with <1.13 to see the difference live.
Expected Behavior
Do not touch player names in scoreboard score packet since no translation is even required.
Additional Server Info
No response
Checklist
- [x] Via plugins are only running on EITHER the backend servers (e.g. Paper) OR the proxy (e.g. BungeeCord), not on both.
- [X] I have included a ViaVersion dump.
- [X] If applicable, I have included a paste (not a screenshot) of the error.
- [X] I have tried a build from https://ci.viaversion.com/ and the issue still persists.
Wasn't the player version issue related to the login event? Fairly sure you should always be able to get the actual client version in the join event.
The code in question here is https://github.com/ViaVersion/ViaVersion/blob/4074352a531cfb0de6fa81e043ee761737748a7a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java#L1077 - I can't remember what exactly it is about, but I do know it is important for something
It wasn't login event, it is called asynchronously in a task started in PlayerJoinEvent. That method could be the reason why it's not working correctly. Suffix following color is normal and fine for me, I made suffix start with last colors of prefix. Unless you have a better idea?
The character rewrite is needed since in old versions display name affects the suffix, while in new ones it doesn't. To avoid prepending reset to suffix the color code is changed to an invalid one (which acts as reset).
Any update on this?