Skip to content

Conversation

tal5
Copy link
Member

@tal5 tal5 commented Sep 20, 2025

Moves over formatted text parsing and features to Paper, using Adventure instead of Bungee chat.

Not going to go over every change for obvious reasons, but overall:

  • FormattedTextHelper & its related classes have been moved to the paper module, and converted to adventure (with minimal fixes for API differences between Bungee chat and adventure).
  • Features that are only relevant when advanced text exist (e.g. hovers, click events, etc.) are also now paper-only.
  • Features that don't strictly require advanced text support (e.g. actions bars, item names, etc.) have been moved to PaperModule methods/changed to use/store JSON strings instead of BaseComponents, which can then be managed using the new parseTextToJson/parseJsonToText compatibility methods.
  • ^ that includes things like player receives message, enchantment script's display name cache, etc.

Some Significant Additions

  • TextFormattingTags in the paper module, implementing all the base text tag bases (e.g. &hover).
  • LegacyColor & LegacyFormatting in FormatteedTextHelper for some places that need that (although ideally we'll be able to move away from that in the future).
  • PaperModule#parseTextToJson/parseJsonToText - compatibility methods, to use a generic format in some places and avoid Spigot/Paper specific impls of things (mostly in NMS stuff).
  • ItemHelper#createItemWithNMSComponents - for converting an item hover to an item on 1.20/21, until PaperMC/Paper#13067.
  • Handler(NMS)#stringifyNMSComponent/parseNMSComponent - replacing the old BaseComponent conversion methods, and operating on dFormattedText instead.

Note

In the URL handling logic at the end of parseInternal, is it meant to be copying the entire component (e.g. including click events and whatnot) as opposed to just the styling?

Note

Not sure if the handling in the Spigot impl of parseTextToJson is correct? Maybe it should utilize TextComponent#fromLegacyText?

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.

1 participant