fix: /plot info escapes MiniMessage colors #3911
Overview
#3911 Fix MiniMessage formatting being escaped in /plot info command
Description
Fixed an issue where MiniMessage formatting in plot flags (greeting, farewell, description, plot-title) was being displayed as escaped/literal text in the /plot info command instead of being properly rendered with formatting.
Problem: When setting flags with MiniMessage formatting like:
/plot flag set greeting <rainbow>Welcome to my plot</rainbow>
The /plot info command would display:
Flags: greeting: <rainbow>Welcome to my plot
Instead of showing the text with proper rainbow formatting.
Root Cause:
The flag display logic in Plot.java was using Component.text() for all flag values, which treats MiniMessage markup as literal text instead of parsing it as formatting.
Solution:
- Added
isMiniMessageFlag()method inCaptionUtility.javato identify flags that should be parsed as MiniMessage (greeting, farewell, description, plot-title) - Enhanced flag display logic in
Plot.javato conditionally parse MiniMessage flags usingMINI_MESSAGE.deserialize()while keeping other flags as plain text - Added error handling with fallback to plain text if MiniMessage parsing fails
Benefits:
- ✅ MiniMessage flags now display with proper formatting in
/plot info - ✅ Non-MiniMessage flags continue to work exactly as before
- ✅ Robust error handling prevents crashes from malformed MiniMessage
- ✅ Backward compatibility maintained
Test Cases:
/plot flag set greeting <rainbow>Welcome!</rainbow>→ displays with rainbow formatting/p flag set greeting <gradient:red:blue>Cool plot</gradient>→ displays with correct formatting
Submitter Checklist
- [X] Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
- [X] Ensure that the pull request title represents the desired changelog entry.
- [X] New public fields and methods are annotated with
@since TODO. - [X] I read and followed the contribution guidelines.
Hm, this might be a conflict of interests. An admin might want to see e.g., hyperlinks, clickable commands, etc. that are part of the message.
Hm, this might be a conflict of interests. An admin might want to see e.g., hyperlinks, clickable commands, etc. that are part of the message.
I can add -raw as well, no problem — but I’d open that as a separate enhancement, since this issue is mainly about fixing the 'bug', right? Or did I get that wrong?
I can add -raw as well, no problem — but I’d open that as a separate enhancement, since this issue is mainly about fixing the 'bug', right? Or did I get that wrong?
It's probably best to add the option in this PR, as the old behaviour is effectively established now, so we should continue to support it
Like this?
FWIW I'd really recommend learning how to use git... It'll make everything a lot easier than copy-pasting files into GitHub from (ngl what I assume to be vibe-coded) local changes.
Otherwise, surely it's easier to just add an overload to the Plot#format method and add a new boolean for rawOutput than using metadata (which just feels janky)