> For the complete documentation index, see [llms.txt](https://kynosdeveloping.gitbook.io/kynosdeveloping/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kynosdeveloping.gitbook.io/kynosdeveloping/kynoslib/message-utilities.md).

# ✉️ Message Utilities

The `MessageUtils` engine handles reading, parsing, and dispatching localization strings directly from configuration files with advanced context support.

#### ✨ Key Features

* 🔄 **Dynamic Placeholders**: Automatically compiles manual placeholder pairs, global placeholders (`{player}`, `{version}`, `{plugin_name}`), and seamless downstream **PlaceholderAPI** parsing.
* 📦 **Context Safety**: Automatically detects if the command executor is a player or the console to adapt context routing safely.
* 🌈 **Integrated Color Flow**: Every message dispatched passes through the `ColorUtils` layer automatically.

#### 💡 API Usage Examples

```java
// Initialize inside your plugin context
MessageUtils msg = new MessageUtils(plugin);

// 1. Fetching strings manually with custom replacements
String customized = msg.get(player, "Messages.SomePath", "{custom_key}", "Custom Value");

// 2. Dispatching single messages directly to a sender
msg.send(sender, "Messages.NoPermission");

// 3. Dispatching multi-line lists from configurations
msg.sendList(sender, "Messages.KynosLibHelp.Instructions");

// 4. Using fast common shorthand methods
msg.sendNoPermission(sender);
msg.sendPlayerOnly(sender);
msg.sendUnknownCommand(sender, "invalidcmd");
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kynosdeveloping.gitbook.io/kynosdeveloping/kynoslib/message-utilities.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
