Skip to content

Fix MiniMessage formatting: default italic on panel items and cross-nested tags in legacyToMiniMessage#2903

Merged
tastybento merged 2 commits intodevelopfrom
copilot/fix-minimassage-format-issue
Apr 5, 2026
Merged

Fix MiniMessage formatting: default italic on panel items and cross-nested tags in legacyToMiniMessage#2903
tastybento merged 2 commits intodevelopfrom
copilot/fix-minimassage-format-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 5, 2026

Panel items render all text italic and show literal </bold> tags in-game, despite correct MiniMessage markup in locale files.

Default italic on panel items

Minecraft applies italic by default to item display names and lore. PanelItem.setName() and setDescription() passed Adventure components to meta.displayName()/meta.lore() without overriding this. Now wraps parsed components with italic=false when italic is not explicitly set:

private static Component removeDefaultItalic(Component component) {
    if (component.decoration(TextDecoration.ITALIC) == TextDecoration.State.NOT_SET) {
        return component.decoration(TextDecoration.ITALIC, TextDecoration.State.FALSE);
    }
    return component;
}

Cross-nested tags in legacyToMiniMessage

Adventure's LegacyComponentSerializer doesn't emit §r when bold ends at a color boundary. §c§lALL §atext (bold carries through color change) was converted to:

<red><bold>ALL </red><green>text</green></bold>

MiniMessage can't match </bold> after </green> is already closed, so it renders as literal text. Fixed by closing decoration tags before color tags, then reopening them:

<red><bold>ALL </bold></red><bold><green>text</green></bold>

The same fix is applied to hex color code (<color:#RRGGBB>) handling in the same method.

… fix tag nesting in legacyToMiniMessage

Two issues fixed:
1. Panel item names and lore were rendered italic by default because
   Minecraft applies italic styling to item components. Now explicitly
   sets italic=false on the root component when not already set.

2. legacyToMiniMessage produced cross-nested tags when bold/decorations
   carried through a color code change without §r reset, causing closing
   tags like </bold> to appear as literal text. Now properly closes and
   reopens decoration tags around color changes to maintain valid nesting.

Agent-Logs-Url: https://github.com/BentoBoxWorld/BentoBox/sessions/f04f5542-587b-4770-917c-d7a22a86563c

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix minimassage format to resolve incorrect tag rendering Fix MiniMessage formatting: default italic on panel items and cross-nested tags in legacyToMiniMessage Apr 5, 2026
Copilot AI requested a review from tastybento April 5, 2026 01:43
@tastybento tastybento marked this pull request as ready for review April 5, 2026 02:08
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 5, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
9.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@tastybento tastybento merged commit 278ad3c into develop Apr 5, 2026
2 of 3 checks passed
@tastybento tastybento deleted the copilot/fix-minimassage-format-issue branch April 5, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The minimessage format is not working properly

2 participants