API interface for interacting with EssentialsC's language system. Messages are resolved per-sender using the following priority:
- The player's manually set language override (via
/language set). - The player's client locale as reported by Bukkit.
- The configured server default language.
Messages are returned as Adventure Components with MiniMessage
formatting already applied. Placeholders in the raw message string are
substituted before deserialization.
Retrieve an instance via EssentialsCAPI.getLanguageApi().
LanguageApi lang = APIProvider.getAPI().getLanguageApi();
// resolve a message with placeholders
Component msg = lang.get(player, "home.teleport.success",
Map.of("name", "base"));
player.sendMessage(msg);
// resolve a message with no placeholders
Component header = lang.get(player, "kit.list.header");
Method Summary
| Component |
get(CommandSender sender, String key, Map<String,String> placeholders) Resolves the message for the given key with placeholder substitution. |
| Component |
get(CommandSender sender, String key) Resolves the message for the given key with no placeholder substitution. |
| void |
setPlayerLanguage(UUID playerUuid, String languageCode) Sets a manual language override for the given player. |
| void |
removePlayerLanguage(UUID playerUuid) Removes the manual language override for the given player. |
| String |
getPlayerLanguage(UUID playerUuid) Returns the manually set language code for the given player, or null. |
| boolean |
hasPlayerLanguage(UUID playerUuid) Returns whether the given player has a manual language override set. |
| Map<UUID,String> |
getPlayerLanguages() Returns a snapshot of all currently active player language overrides. |
| String |
getDefaultLanguage() Returns the server's configured default language code. |
Resolves the message for the given key in the sender's active language, substituting the provided placeholders.
Placeholders are applied by replacing <key> tokens in the raw message string before MiniMessage deserialization. For example, a placeholder entry of "name" -> "base" replaces all occurrences of <name> in the raw string.
If the key is not found in the sender's language, the default language is tried as a fallback. If still not found, an error component is returned.
Parameters:| sender | the sender whose language preference is used for resolution; must not be null |
| key | the message key to look up (e.g. "home.teleport.success"); must not be null |
| placeholders | a map of placeholder names to replacement values, or null if there are no placeholders |
| Component | the resolved Component; never null |
Resolves the message for the given key in the sender's active language with no placeholder substitution.
Equivalent to get(sender, key, null).
| sender | the sender whose language preference is used for resolution; must not be null |
| key | the message key to look up; must not be null |
| Component | the resolved Component; never null |
Sets a manual language override for the given player. Once set, this language takes precedence over the player's client locale. If the language file for the given code has not yet been loaded it is loaded into the cache immediately.
Parameters:| playerUuid | the UUID of the player; must not be null |
| languageCode | the language code to set (e.g. "de_DE"); must not be null |
Removes the manual language override for the given player, returning them to automatic locale detection. Has no effect if the player has no override set.
Parameters:| playerUuid | the UUID of the player; must not be null |
Returns the manually set language code for the given player, or null if no override has been set. A null return means the player's message resolution falls back to their client locale and then the server default.
| playerUuid | the UUID of the player; must not be null |
| String | the language code, or null if no override is set |
Returns whether the given player has a manual language override set. Equivalent to getPlayerLanguage(playerUuid) != null.
| playerUuid | the UUID of the player; must not be null |
| boolean | true if the player has a language override |
Returns a snapshot of all currently active manual player language overrides. The returned map is a copy — modifications have no effect on the internal state.
Returns:| Map<UUID, String> | a map of player UUID to language code; never null, may be empty |
Returns the server's configured default language code. This is used as the final fallback when neither a player override nor a matching client locale file is available.
Returns:| String | the default language code (e.g. "en_US"); never null |