Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for MiniMessage Components #1886

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Joo200
Copy link
Collaborator

@Joo200 Joo200 commented Mar 5, 2022

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:

  • depend on Paper 1.18.2 and Java 17.
  • updated various compile time dependencies (e.g. Checkstyle and shadowjar)
  • Some added methods in Core and Bukkit module. Every change should be fully backwards compatible.

TODO:

  • add some way to add own TagResolvers when sending a MiniMessage's Component.
  • add Warnings when using old color style on MiniMessage servers

@Joo200 Joo200 force-pushed the feature/minimessage branch from 7a36576 to 67face4 Compare March 13, 2022 16:05
@wizjany wizjany added this to the 7.1.0 milestone Jun 14, 2022
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.

2 participants