Skip to content

1.21.5 Bungee chat fixes#2718

Merged
tal5 merged 5 commits intoDenizenScript:devfrom
tal5:Bungee_Serializer_Fixes
Apr 16, 2025
Merged

1.21.5 Bungee chat fixes#2718
tal5 merged 5 commits intoDenizenScript:devfrom
tal5:Bungee_Serializer_Fixes

Conversation

@tal5
Copy link
Copy Markdown
Member

@tal5 tal5 commented Apr 15, 2025

This turned out to be a bunch of stuff in one PR, but will try splitting the commits and description at least.

NMSHandler#getVersion calls before initialization

Needed to check the version in FormattedTextHelper's initialization (before NMSHandler), so the version is now checked and stored in a static block so that it's accessible at all times.

Component JSON parsing

ComponentSerializer#parse can no longer be used, as that uses VersionedComponentSerializer#getDefault which returns the 1.16 serializer.

  • Adds FormattedTextHelper#parseJson which checks the version and runs it though the proper serializer.

Base vanillaStyleSpigotComponentGSON off of default Bungee serializer

  • Adds FormattedTextHelper#getBungeeGson, which returns the Bungee Gson instance.
  • vanillaStyleSpigotComponentGSON now uses getBungeeGson + Gson#newBuilder to #disableHtmlEscaping without having to redefine the entire serializer.

Fixes to HoverFormatHelper's workaround

  • HoverFormatHelper#tryInitializeItemHoverFix is now called right before FormattedTextHelper.vanillaStyleSpigotComponentGSON is initialized, so that it contains the item hover workarounds.
  • tryInitializeItemHoverFix now uses FormattedTextHelper#getBungeeGson.
  • tryInitializeItemHoverFix now has different reflection logic for setting a VersionComponentSerializer vs ComponentSerializer.

@tal5 tal5 merged commit 1ebbea0 into DenizenScript:dev Apr 16, 2025
1 check passed
@tal5 tal5 deleted the Bungee_Serializer_Fixes branch April 16, 2025 19:05
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.

2 participants