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 Type
    Method
    Description
    @NotNull String
    formatRaw(@NotNull String message, boolean includePrefix, Object... placeholders)
    Formats a raw addon-owned message through Zentrix's text pipeline.
    @NotNull net.kyori.adventure.text.Component
    formatRawComponent(@NotNull String message, boolean includePrefix, Object... placeholders)
    Formats a raw addon-owned message through Zentrix's text pipeline.
    @NotNull net.kyori.adventure.text.Component
    getComponent(@NotNull String key, Object... placeholders)
    Resolves a locale key as a prefixed Adventure component.
    @NotNull net.kyori.adventure.text.Component
    getComponentWithoutPrefix(@NotNull String key, Object... placeholders)
    Resolves a locale key as an unprefixed Adventure component.
    @NotNull String
    Gets the active global Zentrix locale name, such as en.
    @NotNull String
    getMessage(@NotNull String key, Object... placeholders)
    Resolves a locale key as a prefixed legacy string.
    @NotNull String
    getMessageWithoutPrefix(@NotNull String key, Object... placeholders)
    Resolves a locale key as an unprefixed legacy string.
  • Method Details

    • getCurrentLocale

      @NotNull @NotNull String getCurrentLocale()
      Gets the active global Zentrix locale name, such as en.
      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 key
      placeholders - 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 key
      placeholders - placeholder key/value pairs
      Returns:
      formatted component without the Zentrix prefix
    • getMessage

      @NotNull @NotNull String getMessage(@NotNull @NotNull String key, Object... placeholders)
      Resolves a locale key as a prefixed legacy string.
      Parameters:
      key - locale key
      placeholders - 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 key
      placeholders - 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 codes
      includePrefix - whether to prepend the active Zentrix prefix
      placeholders - 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 codes
      includePrefix - whether to prepend the active Zentrix prefix
      placeholders - placeholder key/value pairs
      Returns:
      formatted legacy string