Interface ConfigManager

All Known Implementing Classes:
DefaultConfigManager

public interface ConfigManager
Main entry point for configuration management.
  • Method Details

    • get

      @NotNull <T> T get(@NotNull @NotNull Class<T> configClass)
      Gets a loaded config by class.
      Type Parameters:
      T - the config type
      Parameters:
      configClass - the config class
      Returns:
      the config instance
    • getRef

      @NotNull <T> @NotNull ConfigRef<T> getRef(@NotNull @NotNull Class<T> configClass)
      Gets a live reference to a config.
      Type Parameters:
      T - the config type
      Parameters:
      configClass - the config class
      Returns:
      the config reference
    • getFolderConfig

      @NotNull <T> @NotNull Collection<T> getFolderConfig(@NotNull @NotNull Class<T> configClass)
      Gets a folder-based config (folder-config).

      If multiple folder configs exist for this item type, throws an exception instructing to use getFolderConfig(Class, String) instead.

      Type Parameters:
      T - the config type
      Parameters:
      configClass - the config class
      Returns:
      the collection of config instances
    • getFolderConfig

      @NotNull <T> @NotNull Collection<T> getFolderConfig(@NotNull @NotNull Class<T> configClass, @NotNull @NotNull String folderConfigName)
      Gets a folder config by item type and folder config name.
      Type Parameters:
      T - the config type
      Parameters:
      configClass - the config class
      folderConfigName - the folder config name
      Returns:
      the collection of config instances
    • getFolderConfigRef

      @NotNull <T> @NotNull FolderConfigRef<T> getFolderConfigRef(@NotNull @NotNull Class<T> configClass)
      Gets a live folder config reference with edit capabilities.

      If multiple folder configs exist for this item type, throws an exception instructing to use getFolderConfigRef(Class, String) instead.

      Type Parameters:
      T - the config type
      Parameters:
      configClass - the config class
      Returns:
      the folder config reference
    • getFolderConfigRef

      @NotNull <T> @NotNull FolderConfigRef<T> getFolderConfigRef(@NotNull @NotNull Class<T> configClass, @NotNull @NotNull String folderConfigName)
      Gets a live folder config reference by item type and folder config name.
      Type Parameters:
      T - the config type
      Parameters:
      configClass - the config class
      folderConfigName - the folder config name
      Returns:
      the folder config reference
    • get

      @Nullable @Nullable Object get(@NotNull @NotNull String path)
      Gets a value by path.

      Format: "configName:path.to.value" or just "path.to.value"

      Parameters:
      path - the path
      Returns:
      the value, or null if not found
    • get

      @Nullable <T> T get(@NotNull @NotNull String path, @NotNull @NotNull Class<T> type)
      Gets a typed value by path.
      Type Parameters:
      T - the type
      Parameters:
      path - the path
      type - the target type
      Returns:
      the value, or null if not found
    • getString

      @NotNull @NotNull String getString(@NotNull @NotNull String path, @NotNull @NotNull String defaultValue)
      Gets a string value with default.
      Parameters:
      path - the path
      defaultValue - the default value
      Returns:
      the value or default
    • getInt

      int getInt(@NotNull @NotNull String path, int defaultValue)
      Gets an int value with default.
      Parameters:
      path - the path
      defaultValue - the default value
      Returns:
      the value or default
    • getLong

      long getLong(@NotNull @NotNull String path, long defaultValue)
      Gets a long value with default.
      Parameters:
      path - the path
      defaultValue - the default value
      Returns:
      the value or default
    • getBoolean

      boolean getBoolean(@NotNull @NotNull String path, boolean defaultValue)
      Gets a boolean value with default.
      Parameters:
      path - the path
      defaultValue - the default value
      Returns:
      the value or default
    • getDouble

      double getDouble(@NotNull @NotNull String path, double defaultValue)
      Gets a double value with default.
      Parameters:
      path - the path
      defaultValue - the default value
      Returns:
      the value or default
    • getStringList

      @NotNull @NotNull List<String> getStringList(@NotNull @NotNull String path)
      Gets a string list.
      Parameters:
      path - the path
      Returns:
      the list, or empty list if not found
    • register

      <T> void register(@NotNull @NotNull Class<T> configClass)
      Registers a config class for management.
      Type Parameters:
      T - the config type
      Parameters:
      configClass - the config class
    • register

      <T> void register(@NotNull @NotNull Class<T> configClass, @NotNull @NotNull ConfigSource source)
      Registers a config class with a custom source.
      Type Parameters:
      T - the config type
      Parameters:
      configClass - the config class
      source - the config source
    • reload

      void reload(@NotNull @NotNull Class<?> configClass)
      Reloads a specific config.
      Parameters:
      configClass - the config class
    • reloadFolderConfigItem

      void reloadFolderConfigItem(@NotNull @NotNull Class<?> configClass, @NotNull @NotNull String itemId)
      Reloads a specific file in a folder config.

      If multiple folder configs exist for this item type, throws an exception instructing to use reloadFolderConfigItem(Class, String, String) instead.

      Parameters:
      configClass - the config class
      itemId - the item ID (filename without extension)
    • reloadFolderConfigItem

      void reloadFolderConfigItem(@NotNull @NotNull Class<?> configClass, @NotNull @NotNull String folderConfigName, @NotNull @NotNull String itemId)
      Reloads a specific file in a folder config by name.
      Parameters:
      configClass - the config class
      folderConfigName - the folder config name
      itemId - the item ID (filename without extension)
    • reloadAll

      void reloadAll()
      Reloads all managed configs.
    • save

      void save(@NotNull @NotNull Class<?> configClass)
      Saves a config (writes current values to file).
      Parameters:
      configClass - the config class
    • generateDefaults

      void generateDefaults(@NotNull @NotNull Class<?> configClass)
      Generates a default config file with comments.
      Parameters:
      configClass - the config class
    • isRegistered

      boolean isRegistered(@NotNull @NotNull Class<?> configClass)
      Checks if a config class is registered.
      Parameters:
      configClass - the config class
      Returns:
      true if registered
    • getRegisteredConfigs

      @NotNull @NotNull Set<Class<?>> getRegisteredConfigs()
      Gets all registered config classes.
      Returns:
      the set of registered classes
    • getSerializerRegistry

      @NotNull @NotNull TypeSerializerRegistry getSerializerRegistry()
      Gets the serializer registry for registering custom serializers.
      Returns:
      the serializer registry