Phoenix616/MineDown

Replacements are broken by colour code gradients.

Closed this issue · 4 comments

Used Version

1.7.0-SNAPSHOT

Environment description

Windows 10
Java 11

What is happening?

"&e&lClass &8&l»&#ff0-#fff& %gifter% &7has blessed you with extra hearts!"
The %gifter% isn't replaced when there is a gradient across it.

What did you expect to happen?

I expected the %gifter% to be replaced by whatever I specify in my program

Additional context

You will have to use the replaceFirst option on the MineDown class in order for replacements to be applied before parsing. Afterwards it will not work and most likely never will as it would be impossible to apply gradients first and the replace placeholders without the gradient "desyncing".

Unfortunately changing the default behaviour of the parse utility method now is also out of the question as plugins will rely on it being replaced after the formatting was applied, not before.

Is there a way you can change it to replaceFirst(true) by default in your own plugin?

Currently not, no. But providing some way to do that (e.g. via a system property) would be an interesting solution for this.

Okay, thank you!