Interface ModuleConfigAPI


public interface ModuleConfigAPI
API for managing multiple configuration files per module. Each module can have settings.yml, items.yml, rewards.yml, etc. Uses the platform configuration backend internally (no YAML dependency needed in modules).
  • Method Details

    • register

      boolean register(String fileName)
      Register a config file for this module. Creates it from embedded resource if it doesn't exist.
      Parameters:
      fileName - Config file name (e.g., "settings.yml", "items.yml")
      Returns:
      true if registered successfully
    • register

      @Deprecated boolean register(String fileName, int fileVersion)
      Deprecated.
      since 3.4, use register(String). BlueArcade no longer uses file_version / file-version metadata in module files.
      Register a config with legacy file-version compatibility. Modern platform implementations ignore fileVersion; it is kept only so modules compiled against BlueArcade 3.3 and older continue to load without changes.
      Parameters:
      fileName - Config file name
      fileVersion - Legacy version hint
      Returns:
      true if registered successfully
    • registerCopyOnly

      default boolean registerCopyOnly(String fileName)
      Register a config file using a copy-if-missing strategy. The bundled resource is copied to disk only when the user file does not exist. After that the file is loaded as-is without merging with bundled defaults, so any entries the admin deliberately removed are never restored.

      The default implementation falls back to register(String). Platform core implementations override this with the real copy-if-missing logic.

      Parameters:
      fileName - Config file name relative to the module data folder (e.g. "kits.yml")
      Returns:
      true if the file was registered successfully
      Since:
      3.3
    • reload

      void reload(String fileName)
      Reload a specific config file.
      Parameters:
      fileName - Config file name
    • reloadAll

      void reloadAll()
      Reload all registered configs.
    • save

      void save(String fileName)
      Save a specific config file.
      Parameters:
      fileName - Config file name
    • saveAll

      void saveAll()
      Save all registered configs.
    • isRegistered

      boolean isRegistered(String fileName)
      Check if a config file is registered.
      Parameters:
      fileName - Config file name
      Returns:
      true if registered
    • getDataFolder

      File getDataFolder()
      Get module's data folder.
      Returns:
      Module folder (plugins/BlueArcade/modules/{moduleId}/)
    • getRegisteredConfigs

      List<String> getRegisteredConfigs()
      Get list of all registered config file names.
      Returns:
      List of registered config files
    • getString

      String getString(String path)
      Get string from main settings.yml
      Parameters:
      path - Config path
      Returns:
      String value
    • getString

      String getString(String path, String def)
      Get string with default from settings.yml
    • getInt

      int getInt(String path)
      Get int from settings.yml
    • getInt

      int getInt(String path, int def)
      Get int with default from settings.yml
    • getDouble

      double getDouble(String path)
      Get double from settings.yml
    • getDouble

      double getDouble(String path, double def)
      Get double with default from settings.yml
    • getBoolean

      boolean getBoolean(String path)
      Get boolean from settings.yml
    • getBoolean

      boolean getBoolean(String path, boolean def)
      Get boolean with default from settings.yml
    • getStringList

      List<String> getStringList(String path)
      Get string list from settings.yml
    • contains

      boolean contains(String path)
      Check if path exists in settings.yml
    • getStringFrom

      String getStringFrom(String fileName, String path)
      Get string from a specific config file.
      Parameters:
      fileName - Config file name
      path - Config path
      Returns:
      String value
    • getStringFrom

      String getStringFrom(String fileName, String path, String def)
      Get string with default from a specific config file.
    • getIntFrom

      int getIntFrom(String fileName, String path)
      Get int from a specific config file.
    • getIntFrom

      int getIntFrom(String fileName, String path, int def)
      Get int with default from a specific config file.
    • getDoubleFrom

      double getDoubleFrom(String fileName, String path)
      Get double from a specific config file.
    • getDoubleFrom

      double getDoubleFrom(String fileName, String path, double def)
      Get double with default from a specific config file.
    • getBooleanFrom

      boolean getBooleanFrom(String fileName, String path)
      Get boolean from a specific config file.
    • getBooleanFrom

      boolean getBooleanFrom(String fileName, String path, boolean def)
      Get boolean with default from a specific config file.
    • getStringListFrom

      List<String> getStringListFrom(String fileName, String path)
      Get list from a specific config file.
    • containsFrom

      boolean containsFrom(String fileName, String path)
      Check if path exists in a specific config file.
    • getTranslation

      default String getTranslation(Object player, String key)
      Look up a translated string for this module using the runtime language API when available.

      The default implementation preserves legacy behavior by reading from the module's single language.yml file.

      Parameters:
      player - platform player, or null to use the server default locale
      key - translation key
      Returns:
      translated value or the raw key when missing
      Since:
      3.4
    • getTranslation

      default String getTranslation(Object player, String key, String... placeholders)
      Look up a translated string and replace MiniMessage placeholder tokens. Placeholders are passed as pairs: "{name}", "value".
      Parameters:
      player - platform player, or null to use the server default locale
      key - translation key
      placeholders - placeholder pairs
      Returns:
      translated value or the raw key when missing
      Since:
      3.4
    • getTranslation

      default String getTranslation(Object player, String key, Map<String,String> placeholders)
      Look up a translated string and replace MiniMessage placeholder tokens. Placeholder keys are used exactly as supplied, e.g. "{name}".
      Parameters:
      player - platform player, or null to use the server default locale
      key - translation key
      placeholders - placeholder map
      Returns:
      translated value or the raw key when missing
      Since:
      3.4
    • getTranslationOrDefault

      default String getTranslationOrDefault(Object player, String key, String defaultValue)
      Look up a translated string and return a caller-provided fallback when missing.
      Parameters:
      player - platform player, or null to use the server default locale
      key - translation key
      defaultValue - fallback returned when the translation is missing
      Returns:
      translated value or defaultValue
      Since:
      3.4
    • getTranslationOrDefault

      default String getTranslationOrDefault(Object player, String key, String defaultValue, String... placeholders)
    • getTranslationOrDefault

      default String getTranslationOrDefault(Object player, String key, String defaultValue, Map<String,String> placeholders)
    • getTranslationList

      default List<String> getTranslationList(Object player, String key)
      Look up a translated string list for this module using the runtime language API when available. This is intended for scoreboards, menu lore, multi-line result messages, and other localized lists.

      The default implementation preserves legacy behavior by reading from the module's single language.yml file.

      Parameters:
      player - platform player, or null to use the server default locale
      key - translation key
      Returns:
      translated list, or an empty list when missing
      Since:
      3.4
    • getTranslationList

      default List<String> getTranslationList(Object player, String key, String... placeholders)
      Look up a translated string list and replace MiniMessage placeholder tokens. Placeholders are passed as pairs: "{name}", "value".
      Parameters:
      player - platform player, or null to use the server default locale
      key - translation key
      placeholders - placeholder pairs
      Returns:
      translated list, or an empty list when missing
      Since:
      3.4
    • getTranslationList

      default List<String> getTranslationList(Object player, String key, Map<String,String> placeholders)
    • getTranslationListOrDefault

      default List<String> getTranslationListOrDefault(Object player, String key, List<String> defaultValue)
    • getTranslationListOrDefault

      default List<String> getTranslationListOrDefault(Object player, String key, List<String> defaultValue, String... placeholders)
    • getTranslationListOrDefault

      default List<String> getTranslationListOrDefault(Object player, String key, List<String> defaultValue, Map<String,String> placeholders)
    • set

      void set(String path, Object value)
      Set value in settings.yml
    • setIn

      void setIn(String fileName, String path, Object value)
      Set value in a specific config file.