Skip to content

Add useLegacyFormat flag for message parsing#5

Open
LinyaVT wants to merge 1 commit into
IceGames23:mainfrom
CraftingGamesNet:main
Open

Add useLegacyFormat flag for message parsing#5
LinyaVT wants to merge 1 commit into
IceGames23:mainfrom
CraftingGamesNet:main

Conversation

@LinyaVT

@LinyaVT LinyaVT commented Apr 6, 2026

Copy link
Copy Markdown

This PR introduces the performance.useLegacyFormat configuration option (defaulting to false). This flag allows servers to toggle between modern MiniMessage/Hex parsing and Legacy color code processing.

Key Changes
Configuration

  • Added performance.useLegacyFormat to config.yml.
  • When set to true, the plugin skips MiniMessage and Hex regex parsing to reduce CPU overhead.

LangManager

  • Added useLegacyFormat state tracking, refreshed on /lang reload.
  • Updated getTranslation and getCachedTranslation to pass the flag to the utility methods.
  • Added isUseLegacyFormat() getter.
    MessageUtil
  • Added overloaded getMessage and colorize methods that respect the useLegacyFormat boolean.
  • Implemented conditional logic: if legacy mode is enabled, MiniMessageWrapper and HEX_PATTERN matching are skipped, falling back directly to standard ChatColor translation.

LangCommand

  • Updated all user-facing messages within the command handler to forward the current useLegacyFormat setting from the LangManager.

Testing Performed

  • Modern Mode (false): Verified that , , and Hex codes (#FFFFFF) continue to render correctly.
  • Legacy Mode (true): Verified that only standard & codes are translated, and MiniMessage tags are treated as literal text.
  • Reloading: Confirmed that changing the setting in config.yml and running /lang reload applies the change immediately without a server restart.

Introduce a performance.useLegacyFormat config option (default false) to control whether messages are colorized with hex codes or parsed with MiniMessage handling. LangManager now stores and reloads the flag, exposes isUseLegacyFormat(), and passes it when retrieving/colorizing translations. MessageUtil gains overloaded getMessage and colorize methods that respect the flag (skipping MiniMessage/hex parsing when legacy mode is enabled). LangCommand is updated to forward the flag to MessageUtil for all user-facing messages. Also adds the new config entry to config.yml and fixes hex replacement flow in MessageUtil.
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