Added support for MiniMessage Components #1886
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Paper 1.18.2 includes MiniMessage and Adventure 4.10.0.
With this PR I want to add MiniMessage support when available.
E.g.
/rg flag __global__ deny-message <rainbow>Hey, sorry! You can't <what> here.
will display the deny-message in rainbow colors.Every available old replacement (such as
%name%
or%online%
) is replaced by a Placeholder from MiniMessage (<name>
or<online>
). Using MiniMessage to display a greeting message to a player is now/rg flag <id> greeting <yellow>Hello <name>, welcome to the region
.The existing StringFlag type is replaced by a ComponentFlag. ComponentFlag expands StringFlag (should be backwards compatible for most plugins) but has two default values. One default value with legacy formatting and one default value with MiniMessage formatting.
When accessing the default value WorldGuard will pick the correct one.
A new command is added to migrate existing flags:
/rg flag migratecomponents [-y]
will convert every ComponentFlag to the new MiniMessage format when available.This will replace every tag (e.g.
%name%
) too.Needed changes:
TODO: