Repository navigation
Conversation
…ites#3029) * 🐛 fix(gson): Drop unparseable hex colors instead of failing components Vanilla text components may carry hex colors (#RRGGBB) since 1.16, which text3 cannot represent. The old TextColorWrapper deserialization threw JsonParseException and the whole component parse failed. This drops the unparseable color instead, keeping the text content. Named colors still parse as before. * 🐛 fix(gson): Log dropped colors at debug level, add license header Addresses review feedback on IntellectualSites#3029: keep the parse-failure stacktrace available at debug level, and add the GPL header to the new test class. (cherry picked from commit 1fcbef53918675e3edfdda2cd34214232fe9bf10)
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The narrow fallback preserves existing color handling, includes regression tests, and has no identified blocking issues.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents unsupported hex colors in item names from aborting component parsing and WorldEdit commands.
Changes:
- Drops unparseable colors and logs the exception at debug level.
- Adds tests for hex-color fallback and named-color preservation.
| File | Description |
|---|---|
| worldedit-core/src/test/java/com/sk89q/worldedit/util/formatting/text/serializer/gson/StyleSerializerTest.java | Tests unsupported and named color handling. |
| worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/text/serializer/gson/StyleSerializer.java | Handles color parsing failures without rejecting the component. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
dordsor21
approved these changes
Oct 3, 2026
SirYwell
approved these changes
Oct 3, 2026
SirYwell
enabled auto-merge (squash)
October 3, 2026 07:21
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.
Cherry-pick of EngineHub/WorldEdit@1fcbef5 (EngineHub/WorldEdit#3029), applies on top of the approach from #3652.
Running
/repl airwhile holding an item whose custom name contains a hex color (e.g. a menu/gadget item renamed by another plugin) kills the whole command/logs an exception:Cause: The relocated text library (
net.kyori:text3.0.4) predates MC 1.16 —TextColoris an enum of the 16 legacy color names and cannot represent hex colors at all, while vanilla JSON text has allowed"color": "#RRGGBB"since 1.16.Fix: The vendored
StyleSerializer(already copied and relocated from text3 for the 1.21.5 click/hover event updates) now catches theJsonParseExceptionwhen thecolorfield cannot be mapped and drops the color instead of failing the whole component — including the debug-level stacktrace and GPL test header from upstream review. The item name is still shown, just uncolored. As the single choke point of the Gson deserializer, this also covers hover event contents and any other component parsed through it.Verification:
:worldedit-core:testfull suite green, newStyleSerializerTest(2 tests) covers hex-color drop and named-color regression.