Fix hex color codes breaking subsequent legacy color codes#2893
Merged
Conversation
The translateColorCodes method was converting hex codes (e.g., &#FF0000) to §x§F§F§0§0§0§0 format before passing them to Adventure's LEGACY_SERIALIZER which uses '&' as its color character. Since the serializer didn't recognize §x as a hex color prefix (hex parsing is tied to the configured '&' char), this corrupted the hex color and broke any subsequent legacy color codes. Fix: Keep hex codes in &#RRGGBB format so the LEGACY_SERIALIZER (which has .hexColors() enabled) handles them natively. Also add .useUnusualXRepeatedCharacterHexFormat() to the SECTION_SERIALIZER to ensure output uses the BungeeCord-compatible §x§R§R§G§G§B§B format. Fixes BentoBoxWorld/BentoBox hex color display issue. Agent-Logs-Url: https://github.com/BentoBoxWorld/BentoBox/sessions/ae1441c0-1227-42b3-9020-96b6c2fb42ef Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix hex color display error in localization
Fix hex color codes breaking subsequent legacy color codes
Apr 1, 2026
Member
|
@copilot Since the PR to update to using minimessage formatting, does this PR still make sense to do? |
|
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.



Hex colors like
&#FF0000followed by legacy codes like&arendered incorrectly — the hex color was garbled and all subsequent legacy codes stopped working.Root cause:
translateColorCodes()pre-converted hex codes to§x§F§F…(section-sign format) before passing the string to Adventure'sLEGACY_SERIALIZER, which is configured with&as its color character. The serializer didn't recognize§xas a hex prefix (hex parsing is bound to the configured character), so it mangled the hex sequence and lost track of subsequent&codes.Changes:
§format — leave&#RRGGBBintact (only expand 3-digit shorthand to 6-digit) so theLEGACY_SERIALIZERwith.hexColors()parses them natively alongside&a-style codes.useUnusualXRepeatedCharacterHexFormat()toSECTION_SERIALIZERso output uses BungeeCord-compatible§x§R§R§G§G§B§Bformat instead of§#RRGGBBBefore/after for
&#FF0000Red &aGreen: