Interface LocaleService
public interface LocaleService
Access to Zentrix's active locale and text formatting pipeline.
Addons should use this service when they need messages to match the server's current Zentrix locale, prefix, small-caps setting, hex colors, and legacy color handling without depending on Zentrix internals.
- Since:
- 1.5.0
-
Method Summary
Modifier and TypeMethodDescription@NotNull StringFormats a raw addon-owned message through Zentrix's text pipeline.@NotNull net.kyori.adventure.text.ComponentformatRawComponent(@NotNull String message, boolean includePrefix, Object... placeholders) Formats a raw addon-owned message through Zentrix's text pipeline.@NotNull net.kyori.adventure.text.ComponentgetComponent(@NotNull String key, Object... placeholders) Resolves a locale key as a prefixed Adventure component.@NotNull net.kyori.adventure.text.ComponentgetComponentWithoutPrefix(@NotNull String key, Object... placeholders) Resolves a locale key as an unprefixed Adventure component.@NotNull StringGets the active global Zentrix locale name, such asen.@NotNull StringgetMessage(@NotNull String key, Object... placeholders) Resolves a locale key as a prefixed legacy string.@NotNull StringgetMessageWithoutPrefix(@NotNull String key, Object... placeholders) Resolves a locale key as an unprefixed legacy string.
-
Method Details
-
getCurrentLocale
Gets the active global Zentrix locale name, such asen.- Returns:
- active locale name
-
getComponent
@NotNull @NotNull net.kyori.adventure.text.Component getComponent(@NotNull @NotNull String key, Object... placeholders) Resolves a locale key as a prefixed Adventure component.- Parameters:
key- locale keyplaceholders- placeholder key/value pairs- Returns:
- formatted component with the Zentrix prefix
-
getComponentWithoutPrefix
@NotNull @NotNull net.kyori.adventure.text.Component getComponentWithoutPrefix(@NotNull @NotNull String key, Object... placeholders) Resolves a locale key as an unprefixed Adventure component.- Parameters:
key- locale keyplaceholders- placeholder key/value pairs- Returns:
- formatted component without the Zentrix prefix
-
getMessage
Resolves a locale key as a prefixed legacy string.- Parameters:
key- locale keyplaceholders- placeholder key/value pairs- Returns:
- formatted string with the Zentrix prefix
-
getMessageWithoutPrefix
@NotNull @NotNull String getMessageWithoutPrefix(@NotNull @NotNull String key, Object... placeholders) Resolves a locale key as an unprefixed legacy string.- Parameters:
key- locale keyplaceholders- placeholder key/value pairs- Returns:
- formatted string without the Zentrix prefix
-
formatRawComponent
@NotNull @NotNull net.kyori.adventure.text.Component formatRawComponent(@NotNull @NotNull String message, boolean includePrefix, Object... placeholders) Formats a raw addon-owned message through Zentrix's text pipeline.- Parameters:
message- raw message containing Zentrix placeholders/color codesincludePrefix- whether to prepend the active Zentrix prefixplaceholders- placeholder key/value pairs- Returns:
- formatted component
-
formatRaw
@NotNull @NotNull String formatRaw(@NotNull @NotNull String message, boolean includePrefix, Object... placeholders) Formats a raw addon-owned message through Zentrix's text pipeline.- Parameters:
message- raw message containing Zentrix placeholders/color codesincludePrefix- whether to prepend the active Zentrix prefixplaceholders- placeholder key/value pairs- Returns:
- formatted legacy string
-