Class LanguageConfig

java.lang.Object
dev.ua.theroer.magicutils.lang.LanguageConfig

@ConfigFile("lang/{lang}.{ext}") @Comment("Language file for MagicUtils") public class LanguageConfig extends Object
Language configuration using the MagicUtils config system.

After load, a flat key -> value cache is built from all configured sections so runtime getMessage(String) lookups are plain Map.get calls and never touch reflection.

  • Constructor Details

    • LanguageConfig

      public LanguageConfig()
      Default constructor for LanguageConfig.
  • Method Details

    • putCustomMessage

      public void putCustomMessage(String key, String value)
      Adds or updates a custom message entry.
      Parameters:
      key - message key
      value - message text (null removes the key)
    • getMessage

      public String getMessage(String key)
      Resolves a message by key. Custom plugin messages take precedence over the built-in sectioned messages.

      Built-in keys follow the magicutils.<section>.<field> pattern. The resolution uses a flat cache built lazily on first access so there is no reflection on the hot path.

      Parameters:
      key - message key
      Returns:
      resolved value or null when no entry exists