feat: support MiniMessage and hex colours in phase text - #551
Merged
Conversation
An admin coloured a phase hologram with <green><bold>...</green> and got white text with the tags shown literally. Holograms deserialized with LegacyComponentSerializer.legacyAmpersand(), which understands the 16 legacy & codes and nothing else - Adventure builds that instance with hexColours=false, so even &#RRGGBB did not work. The action bar used a second, separately configured serializer that did support hex but not MiniMessage. Two display paths, two different answers to "what formatting can I use here", neither documented where anyone would look. Both now go through Util.parseMiniMessageOrLegacy, which accepts MiniMessage, & and section codes, hex, and any mixture, and is cached on the BentoBox side. This also fixes section codes being rendered as literal text. Translations come back from User.getTranslation already converted to section codes, so anything locale-sourced was being handed to a serializer bound to '&' - the starting hologram (aoneblock.island.starting-hologram) and the action bar both took that path. Phase file hologram lines never see the translation layer, which is why the reported case showed raw MiniMessage tags rather than raw section codes. The boss bar title is untouched: it uses the String-based Bukkit BossBar API and BentoBox has already resolved its formatting by then. Existing configs are unaffected. BentoBox's MiniMessage instance is the non-strict one, so text containing stray angle brackets is left as literal text rather than throwing. Documented the accepted syntax in the phase file, next to the holograms section where the admin was already looking. Util.parseMiniMessageOrLegacy is BentoBox 3.2.0 API, so this needs no dependency bump. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014t1DSo2wMbTWZLcwXpwUmQ
|
This was referenced Aug 8, 2026
Merged
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.



The report
An admin coloured a phase hologram with
<green><bold>Начало (Равнина)</bold></green>and got white text with the tags rendered literally.Why
Holograms deserialized with
LegacyComponentSerializer.legacyAmpersand(), which understands the 16 legacy&codes and nothing else. Adventure builds that instance withhexColours = false, so even&#RRGGBBdid not work there.The action bar used a second, separately configured serializer that did support hex but not MiniMessage. Two display paths, two different answers to "what formatting can I use here", and neither documented where anyone would look.
&only&,§, hex, MiniMessage&+ hex&,§, hex, MiniMessageThe fix
Both Component paths now use
Util.parseMiniMessageOrLegacy, which accepts MiniMessage,&and§codes, hex, and any mixture — and is cached on the BentoBox side, so the per-block hologram and action bar rebuilds do not re-parse the same strings.This also fixes
§codes being rendered as literal text. Translations come back fromUser.getTranslationalready converted to§codes, so anything locale-sourced was being handed to a serializer bound to&. That affected the starting hologram (aoneblock.island.starting-hologram) and the action bar. Phase file hologram lines never see the translation layer, which is why the reported case showed raw MiniMessage tags rather than raw§codes.I flagged this
§behaviour as suspected when I first read the code — it is now confirmed by tests that fail against the old serializer.Compatibility
&codes keep working and are covered by tests.MiniMessage.miniMessage(), so a hologram containing stray angle brackets (<-- break this) is left as literal text rather than throwing.Util.parseMiniMessageOrLegacyis BentoBox 3.2.0 API — no dependency bump needed. This branch is based ondevelopand is independent of fix: do not lose island progress when the server restarts #550.Docs
Updated the
holograms:block in0_plains.yml— the reference phase file, and where the admin was already looking — to show all three syntaxes plus a gradient example.Tests
565 passing. New coverage on both paths for MiniMessage, gradients,
&codes,§codes and hex, asserting on the serialized formatting rather than the component tree shape.Not boot-tested on a live server — the behaviour is exercised through the real
Utilcode path in tests, but I have not watched a hologram render in-game.🤖 Generated with Claude Code
https://claude.ai/code/session_014t1DSo2wMbTWZLcwXpwUmQ