Act as an Expert Senior Minecraft Java Plugin Developer (Paper API 1.21.x). I need you to create a completely custom, lightweight, and highly optimized Chat Color plugin.
The plugin must be compiled for Java 21 and Paper 1.21.x with ZERO compilation errors and NO deprecated methods. It must cause absolutely ZERO lag and no server crashes.
CORE FEATURES & LOGIC:
- Modern Chat Event: - Use Paper's modern
AsyncChatEvent (do NOT use the deprecated AsyncPlayerChatEvent).
- Only change the color of the chat MESSAGE itself, keeping the player's name and prefix formatting intact.
- Data Storage (Zero Lag):
- Do NOT use external files (like data.yml) to save player colors, as it causes I/O lag. - Use Minecraft's native PersistentDataContainer (PDC) to save the player's selected chat color directly to their UUID. This ensures data is never lost and loads instantly.
- Default State:
- If a player has not selected any color (or is new), their chat must remain the default server color.
- Colors, Commands, and Permissions:
- The plugin must support exactly these colors: red, dark-red, gold, yellow, lime, green, aqua, cyan, light-blue, blue, purple, pink, white, gray, dark-gray, black. - Command structure: /chatcolor <color> (e.g., /chatcolor red, /chatcolor light-blue). - Every single color MUST have its own strict permission. Format: chatcolor.use.<color> (e.g., chatcolor.use.red, chatcolor.use.dark-gray). - If a player doesn't have the permission for that specific color, deny them with an error message.
- Reset/Remove Color:
- Command: /chatcolor reset or /chatcolor off. - Permission: chatcolor.use.reset - This will remove their PDC data and revert their chat color back to default.
- Configuration File (config.yml):
- Provide a config.yml where I can change the plugin's prefix. - Example format: ``yaml prefix: "<gray>[<gold>ChatColor<gray>] " messages: color_changed: "<green>Your chat color has been changed to <color_name>!" color_reset: "<yellow>Your chat color has been reset to default." no_permission: "<red>You do not have permission to use this color!" invalid_color: "<red>Invalid color! Use /chatcolor list." ` - Use MiniMessage formatting (e.g., <red>, <green>) for all messages as it is the standard for Paper 1.21.x.
PROJECT STRUCTURE:
Please provide the complete project code including:
- Main.java
- ChatListener.java
(Handling AsyncChatEvent) - ChatColorCommand.java
(Handling /chatcolor, applying PDC, and checking permissions) - plugin.yml` (Registering the command and declaring permissions)
Make sure the code is extremely clean, handles Component formatting safely, and is fully ready to be compiled.
I need this all colours red dark-red gold yellow lime green aqua cyan light-blue blue purple pink white gray dark-gray black