API interface for interacting with EssentialsC's chat formatting system. The chat system processes outgoing player messages through LuckPerms group formats and PlaceholderAPI placeholders when both are available and enabled. This API lets you query the current state of the system and run a message through the same formatting pipeline manually.
Retrieve an instance via EssentialsCAPI.getChatApi().
ChatApi chat = APIProvider.getAPI().getChatApi();
if (chat.isActive()) {
Component formatted = chat.formatMessage(player, "Hello world");
player.getServer().broadcast(formatted);
}
Method Summary
| boolean |
isLuckPermsChatEnabled() Returns whether LuckPerms chat formatting is enabled in the config. |
| boolean |
isLuckPermsAvailable() Returns whether the LuckPerms API is currently loaded and available. |
| boolean |
isActive() Returns whether the chat system is fully active — config enabled and LuckPerms available. |
| boolean |
canUseColorCodes(Player player) Returns whether the player can use legacy color codes in chat. |
| boolean |
canUseRgbCodes(Player player) Returns whether the player can use hex/RGB color codes in chat. |
| Component |
formatMessage(Player player, String message) Formats a raw chat message through the full EssentialsC pipeline and returns a Component. |
Returns whether LuckPerms-based chat formatting is enabled in the plugin config.
This reflects the config value only — the LuckPerms plugin may still be unavailable at runtime even if this returns true. Use isActive() to check both conditions at once.
| boolean | true if LuckPerms chat formatting is switched on in the config |
Returns whether the LuckPerms API is currently loaded and available.
This can return false even when LuckPerms is installed if the plugin loaded before LuckPerms finished registering its service provider.
| boolean | true if the LuckPerms API was successfully obtained at startup or last reload |
Returns whether chat formatting is fully active — that is, both the config option is enabled and the LuckPerms API is available.
Equivalent to isLuckPermsChatEnabled() && isLuckPermsAvailable().
| boolean | true if the chat system will process outgoing messages |
Returns whether the given player is allowed to use legacy color codes (e.g. &c, &l) in chat.
Checks for the essentialsc.chat.legacycodes permission.
| player | the player to check; must not be null |
| boolean | true if the player has the essentialsc.chat.legacycodes permission |
Returns whether the given player is allowed to use hex/RGB color codes (e.g. &#FF5500) in chat.
Checks for the essentialsc.chat.rbgcodes permission.
| player | the player to check; must not be null |
| boolean | true if the player has the essentialsc.chat.rbgcodes permission |
Formats a raw chat message for the given player through the full EssentialsC chat pipeline and returns the result as an Adventure Component.
The pipeline applies, in order:
- Hex color translation (
&#RRGGBB) if the player hasessentialsc.chat.rbgcodes - Legacy color code translation (
&c, etc.) if the player hasessentialsc.chat.legacycodes - LuckPerms group format lookup (
group-formats.<group>in config, falling back tochat-format) - PlaceholderAPI placeholder expansion if PlaceholderAPI is present
- Prefix, suffix, and name substitution from LuckPerms metadata
If the chat system is not active (see isActive()), this method returns the raw message deserialized as a plain Component with no LuckPerms formatting applied.
| player | the player whose format and permissions are used; must not be null |
| message | the raw message string as typed by the player; must not be null |
| Component | the fully formatted Adventure Component; never null |