Class Lang

java.lang.Object
com.github.darksoulq.abyssallib.server.resource.asset.Lang
All Implemented Interfaces:
Asset

@Experimental public class Lang extends Object implements Asset
Represents a language file (.lang/.json) for Minecraft resource packs. Supports manual addition of translation keys or automatic loading from plugin resources.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Lang(@NotNull String namespace, @NotNull String lang)
    Creates an empty language file.
    Lang(@NotNull String namespace, @NotNull String lang, byte[] data)
     
    Lang(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull String namespace, @NotNull String lang)
    Loads the language file from the plugin JAR at path: resourcepack/{namespace}/lang/{lang}.json.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    emit(@NotNull Map<String,byte[]> files)
    Emits this language file to the provided file map in JSON format.
    void
    put(@NotNull String key, @NotNull String value)
    Adds or updates a translation entry.

    Methods inherited from class Object

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

    • Lang

      public Lang(@NotNull @NotNull String namespace, @NotNull @NotNull String lang)
      Creates an empty language file.
      Parameters:
      namespace - the namespace of the resource pack
      lang - the language code (e.g., en_us)
    • Lang

      public Lang(@NotNull @NotNull String namespace, @NotNull @NotNull String lang, byte[] data)
    • Lang

      public Lang(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull String namespace, @NotNull @NotNull String lang)
      Loads the language file from the plugin JAR at path: resourcepack/{namespace}/lang/{lang}.json.
      Parameters:
      plugin - the plugin whose JAR is scanned
      namespace - the namespace of the resource pack
      lang - the language code (e.g., en_us)
  • Method Details

    • put

      public void put(@NotNull @NotNull String key, @NotNull @NotNull String value)
      Adds or updates a translation entry.
      Parameters:
      key - the translation key (e.g., item.example.name)
      value - the translated string (e.g., Example Item)
    • emit

      public void emit(@NotNull @NotNull Map<String,byte[]> files)
      Emits this language file to the provided file map in JSON format.
      Specified by:
      emit in interface Asset
      Parameters:
      files - the map to write generated files into