Fix: truncate long boss bar titles before sending to Bedrock#6501
Closed
andreiusq wants to merge 2 commits into
Closed
Fix: truncate long boss bar titles before sending to Bedrock#6501andreiusq wants to merge 2 commits into
andreiusq wants to merge 2 commits into
Conversation
Some newer Bedrock clients (seen on protocol 1001) disconnect right after joining when they receive a boss bar with a very long title. A 40 character title works fine, but a ~293 character one kills the connection. Cap the title length in BossBar before it goes out, and strip a trailing section sign if the cut lands in the middle of a color code so we don't send a broken formatting sequence. Also pulled the duplicated title conversion into a small helper since both the create and rename paths needed the same fix.
Novampr
approved these changes
Jul 2, 2026
Contributor
|
If you used any AI, please see our AI policy: https://github.com/GeyserMC/.github/blob/master/AI_POLICY.md |
onebeastchris
requested changes
Jul 6, 2026
| } | ||
| } | ||
| // Escape percent signs after truncating so we never split an escape sequence in half | ||
| return bedrockTitle.replace("%", "%%%%"); |
Member
There was a problem hiding this comment.
This could result in titles being longer than 256 chars...
Author
|
Good catch! escaping |
Escaping "%" to "%%%%" after truncating to the length cap could grow the title back past it, reintroducing the disconnect the truncation was meant to prevent. Build the escaped output incrementally so the cap is enforced on what's actually sent.
c324022 to
acb7849
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Newer Bedrock clients (reported on protocol 1001 / MC 26.x) disconnect immediately after joining when they receive a boss bar with a very long title. Testing on the issue showed a 40 character title joins fine while a ~293 character one drops the connection right away. This shows up with plugins like TabTPS whose boss bar text can get very long when translation keys aren't resolved.
Fixes #6496
Change
BossBarnow caps the title length before the packet is sent. If the cut would land in the middle of a color code I drop the trailing section sign so we don't send a broken formatting sequence, and the%escaping is done after the trim so an escape sequence can't be split.Both the create and rename paths sent the same title, so I moved that conversion into a small
bedrockTitle()helper instead of duplicating it.The limit is set at 256, which is under the point where clients start dropping the connection and still far longer than any normal boss bar title.
Testing
Tested in-game on Paper with a Bedrock client: creating a boss bar with a 300+ character title (via
/bossbar) no longer disconnects the client, and the title shows up truncated../gradlew :core:compileJavabuilds clean.