Class ConfigRegistry

java.lang.Object
johnsmith.configoverhauled.api.registry.ConfigRegistry

public class ConfigRegistry extends Object
Centralized registry for managing and retrieving active configuration managers across all dependent mods. Utilizes the Java ServiceLoader to dynamically resolve platform-specific factory implementations.
  • Constructor Details

    • ConfigRegistry

      public ConfigRegistry()
  • Method Details

    • registerManager

      public static void registerManager(ConfigManager manager)
      Binds an initialized configuration manager to the registry under its respective mod identifier.
      Parameters:
      manager - The configuration manager instance to register.
    • getManager

      public static ConfigManager getManager(String modId)
      Retrieves the registered configuration manager for a specific mod identifier.
      Parameters:
      modId - The target mod identifier.
      Returns:
      The associated configuration manager, or null if unassigned.
    • getOrCreateManager

      public static ConfigManager getOrCreateManager(String modId)
      Retrieves an existing configuration manager or structurally allocates a new instance via the resolved factory. Implements thread-safe double-checked locking to prevent race conditions during concurrent initialization.
      Parameters:
      modId - The target mod identifier.
      Returns:
      A valid configuration manager scoped to the provided identifier.
    • saveAllSynchronously

      public static void saveAllSynchronously()
      Instructs all registered configuration managers to execute synchronous disk-write operations.
    • getAllManagers

      public static Collection<ConfigManager> getAllManagers()
      Retrieves all currently active configuration managers.
      Returns:
      A collection of registered configuration managers.
    • getDependentModIDs

      public static List<String> getDependentModIDs()
      Retrieves a list of all mod identifiers actively utilizing the framework.
      Returns:
      A list of registered mod identifiers.