Skip to content

Conversation

@Leviaria
Copy link
Contributor

@Leviaria Leviaria commented Aug 3, 2025

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.

image

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.

image

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:

  1. Added isMiniMessageFlag() method in CaptionUtility.java to identify flags that should be parsed as MiniMessage (greeting, farewell, description, plot-title)
  2. Enhanced flag display logic in Plot.java to conditionally parse MiniMessage flags using MINI_MESSAGE.deserialize() while keeping other flags as plain text
  3. 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

  • Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
  • Ensure that the pull request title represents the desired changelog entry.
  • New public fields and methods are annotated with @since TODO.
  • I read and followed the contribution guidelines.

@Leviaria Leviaria requested a review from a team as a code owner August 3, 2025 12:37
@github-actions github-actions bot added the Bugfix This PR fixes a bug label Aug 3, 2025
@SirYwell
Copy link
Member

SirYwell commented Aug 3, 2025

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.

@Leviaria
Copy link
Contributor Author

Leviaria commented Aug 3, 2025

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?

@dordsor21
Copy link
Member

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

@Leviaria
Copy link
Contributor Author

Leviaria commented Aug 3, 2025

Animation

Like this?

@dordsor21
Copy link
Member

dordsor21 commented Aug 3, 2025

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix This PR fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants