placeholders.yml file. These placeholders are resolved before MiniMessage parsing, allowing you to use MiniMessage formatting within placeholder values.
Overview
Custom placeholders are useful for:- Defining server-wide constants (server name, IP, Discord link, etc.)
- Creating reusable formatted text snippets
- Centralizing commonly-used text with MiniMessage formatting
- Simplifying complex MiniMessage syntax into simple placeholders
Custom placeholders are static and do not change dynamically. For dynamic placeholders, use PlaceholderAPI or MiniPlaceholders integration.
Configuration Structure
Theplaceholders.yml file uses a simple key-value structure:
A map of placeholder names to their values. Each key becomes a placeholder that can be used in messages.
Usage
Custom placeholders use the standard placeholder syntax:%placeholder_name%
Basic Example
placeholders.yml
MiniMessage Support
Custom placeholders fully support MiniMessage formatting, allowing you to create richly formatted reusable text.Formatted Examples
placeholders.yml
Using Formatted Placeholders
Once defined, you can use these placeholders in your plugin messages:When using MiniMessage in placeholder values, you don’t need the
[mm] prefix. The placeholders themselves are always parsed as MiniMessage.Combining Placeholders
You can use placeholders within other placeholders:placeholders.yml
Advanced Examples
Role Badges
Status Messages
Chat Formatting
Best Practices
Use descriptive placeholder names with underscores (e.g.,
server_name, error_prefix) for better readability.Naming Conventions
- Use lowercase with underscores:
server_namenotServerName - Be descriptive:
error_prefixnotep - Group related placeholders:
badge_owner,badge_admin,badge_mod
Performance Considerations
- Custom placeholders are static and loaded once at startup
- They have minimal performance impact
- Use them freely for commonly-used formatted text
Reloading
After modifyingplaceholders.yml, reload the configuration:
Integration with Placeholder Plugins
Custom placeholders work alongside PlaceholderAPI and MiniPlaceholders:%player_name% will be resolved first, then the MiniMessage gradient will be applied.
Custom placeholders are resolved in the order they’re defined. If you reference another placeholder, make sure it’s defined earlier in the file.