Class ServerTranslator

java.lang.Object
com.github.darksoulq.abyssallib.server.translation.ServerTranslator

public final class ServerTranslator extends Object
Utility class for managing server-side component translations and MiniMessage parsing.

This system decouples entirely from Adventure's standard GlobalTranslator to avert Server-Side Rendering conflicts. It manually resolves formatting indexes, nested localized tags, and custom item-specific components prior to evaluating the raw string through the overarching MiniMessage implementation.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.github.darksoulq.abyssallib.server.translation.internal.CustomTranslator
    Returns the master translation interface acting as fundamental repository controlling formatting operations.
    static void
    Initializes the server translation module and invokes the primary language loading sequence.
    static void
    loadFile(@NotNull Path path)
    Integrates raw translation properties parsed strictly from externally registered storage allocations.
    static void
    loadResource(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull String resourcePath)
    Incorporates raw property details derived inherently from a specific compiled project resource payload.
    static net.kyori.adventure.text.Component
    parseText(@NotNull String text, @Nullable org.bukkit.entity.Player player, @NotNull net.kyori.adventure.text.minimessage.tag.resolver.TagResolver... extraResolvers)
     
    static void
    Registers a global translation provider empowering dynamic resolution of component keys system-wide.
    static void
    registerGlobalResolver(@NotNull net.kyori.adventure.text.minimessage.tag.resolver.TagResolver resolver)
    Registers a global TagResolver that will be applied to all translated components.
    static void
    Registers a custom item translation provider empowering dynamic resolution of item-bound translatable component keys.
    static void
    Reloads all active translation configurations traversing registered system files and internally bundled plugin resources.
    static net.kyori.adventure.text.Component
    render(@NotNull String key, @Nullable org.bukkit.entity.Player player, @NotNull net.kyori.adventure.text.minimessage.tag.resolver.TagResolver... extraResolvers)
    Instigates singular execution interpreting unique translation targets directly avoiding generalized component generation.
    static net.kyori.adventure.text.Component
    translate(@Nullable net.kyori.adventure.text.Component component, @Nullable Locale locale)
    Translates a provided raw component directly utilizing the specified system locale.
    static net.kyori.adventure.text.Component
    translate(@Nullable net.kyori.adventure.text.Component component, @Nullable org.bukkit.entity.Player player)
    Translates a provided raw component adapting directly to an observing player's locale and placeholder contexts.
    static net.kyori.adventure.text.Component
    translateItemComponent(@Nullable net.kyori.adventure.text.Component component, @Nullable org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.ItemStack item, @NotNull ItemTranslationContext context)
    Contextually evaluates an item's specific translatable component conditionally applying registered item translation providers.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ServerTranslator

      public ServerTranslator()
  • Method Details

    • init

      public static void init()
      Initializes the server translation module and invokes the primary language loading sequence.
    • reload

      public static void reload()
      Reloads all active translation configurations traversing registered system files and internally bundled plugin resources.
    • registerItemProvider

      public static void registerItemProvider(@NotNull @NotNull ItemTranslationProvider provider)
      Registers a custom item translation provider empowering dynamic resolution of item-bound translatable component keys.
      Parameters:
      provider - The provider implementation added to the internal resolution registry.
    • registerGlobalProvider

      public static void registerGlobalProvider(@NotNull @NotNull GlobalTranslationProvider provider)
      Registers a global translation provider empowering dynamic resolution of component keys system-wide.
      Parameters:
      provider - The provider implementation added to the global resolution registry.
    • parseText

      public static net.kyori.adventure.text.Component parseText(@NotNull @NotNull String text, @Nullable @Nullable org.bukkit.entity.Player player, @NotNull @NotNull net.kyori.adventure.text.minimessage.tag.resolver.TagResolver... extraResolvers)
    • registerGlobalResolver

      public static void registerGlobalResolver(@NotNull @NotNull net.kyori.adventure.text.minimessage.tag.resolver.TagResolver resolver)
      Registers a global TagResolver that will be applied to all translated components.
      Parameters:
      resolver - The TagResolver to add to the global registry.
    • translate

      public static net.kyori.adventure.text.Component translate(@Nullable @Nullable net.kyori.adventure.text.Component component, @Nullable @Nullable Locale locale)
      Translates a provided raw component directly utilizing the specified system locale.
      Parameters:
      component - The raw translatable component requiring localization resolution.
      locale - The language locale identifying the corresponding target dictionary entries.
      Returns:
      A localized component resolving all internally mapped keys and parameters.
    • translate

      public static net.kyori.adventure.text.Component translate(@Nullable @Nullable net.kyori.adventure.text.Component component, @Nullable @Nullable org.bukkit.entity.Player player)
      Translates a provided raw component adapting directly to an observing player's locale and placeholder contexts.
      Parameters:
      component - The raw translatable component requiring localization resolution.
      player - The viewing player whose client locale and active placeholders execute against the text.
      Returns:
      A localized component resolving mapped parameters accurately assigned to the viewer.
    • translateItemComponent

      public static net.kyori.adventure.text.Component translateItemComponent(@Nullable @Nullable net.kyori.adventure.text.Component component, @Nullable @Nullable org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.inventory.ItemStack item, @NotNull @NotNull ItemTranslationContext context)
      Contextually evaluates an item's specific translatable component conditionally applying registered item translation providers.
      Parameters:
      component - The raw item component requiring immediate localization processing.
      player - The target viewer currently examining the inventory item stack.
      item - The interactive item stack directly associated with the specific component context.
      context - The specific area categorical classification rendering the component.
      Returns:
      A natively localized component resolving keys distinctively relative to the encompassing item.
    • render

      public static net.kyori.adventure.text.Component render(@NotNull @NotNull String key, @Nullable @Nullable org.bukkit.entity.Player player, @NotNull @NotNull net.kyori.adventure.text.minimessage.tag.resolver.TagResolver... extraResolvers)
      Instigates singular execution interpreting unique translation targets directly avoiding generalized component generation.
      Parameters:
      key - The singular translation identifier accessing active application dictionary resources.
      player - The viewing target allocating accurate visual logic placeholders against variables.
      extraResolvers - Sequential array storing externally mandated resolution mappings executed during translation.
      Returns:
      Formatted static text structure mirroring underlying system configurations effectively.
    • loadFile

      public static void loadFile(@NotNull @NotNull Path path)
      Integrates raw translation properties parsed strictly from externally registered storage allocations.
      Parameters:
      path - The operating system file target navigating specifically to the language properties.
    • loadResource

      public static void loadResource(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull String resourcePath)
      Incorporates raw property details derived inherently from a specific compiled project resource payload.
      Parameters:
      plugin - The compiled java module acting as root target for path acquisition algorithms.
      resourcePath - The internally nested pathway mapped cleanly against the desired asset array.
    • getSource

      public static com.github.darksoulq.abyssallib.server.translation.internal.CustomTranslator getSource()
      Returns the master translation interface acting as fundamental repository controlling formatting operations.
      Returns:
      The translation structure mapped against active project variables determining overall strings.