Skip to content

Placeholder System

Cris edited this page Mar 28, 2025 · 2 revisions

This system allows the creation and management of custom placeholders through YAML files, organized within a directory called placeholders. Files can be structured into multiple subdirectories and contain placeholders with different formats and functionalities.


File Structure

YAML files can be organized into any number of subdirectories within MyMessage/placeholders/, providing a flexible structure.

Example file structure:

MyMessage/
 |
placeholders/  
 ├── global.yml  
 ├── messages/  
 │   ├── errors.yml  
 │   ├── notifications.yml  
 ├── custom/  
 │   ├── example.yml  

Each YAML file must follow this format:

placeholders:
  <placeholder-key>:
    type: <available-types>
    value: "Example value"
  • <placeholder-key>: Name of the placeholder used in the system (No use snake case -> my_placeholder).
  • <available-types>: Placeholder type.
  • value: Placeholder content.

Placeholder Types

1. Text

text

This type allows defining placeholders with dynamic values, supporting arguments in the message.

Example Configuration

placeholders:
  greeting:
    type: text
    value: "Hello {0}, {1}!"

Expected Result

Placeholder: %mm_greeting%

Without arguments: "Hello {0}, {1}!".

With arguments: "Hello John, welcome!" (%mm_greeting_args:John;welcome%).

2. Color text

color_text

This type allows defining placeholders with customizable color formats. Depending on the chosen format (legacy, console or minimessage), the output will change.

Example Configuration

placeholders:
  welcome-message:
    type: color_text
    value: "<red>Welcome!"

Available Formats

Placeholder Format Output
%mm_welcome-message_legacy% legacy &cWelcome
%mm_welcome-message_console% console §cWelcome
%mm_welcome-message_minimessage% minimessage <red>Welcome

Clone this wiki locally