Class DefaultConfigManager

java.lang.Object
johnsmith.configoverhauled.impl.core.DefaultConfigManager
All Implemented Interfaces:
ConfigManager

public class DefaultConfigManager extends Object implements ConfigManager
  • Constructor Details

    • DefaultConfigManager

      public DefaultConfigManager(String modId, org.slf4j.Logger logger)
  • Method Details

    • modId

      public String modId()
      Description copied from interface: ConfigManager
      Retrieves the bound namespace identifier.
      Specified by:
      modId in interface ConfigManager
      Returns:
      The registered mod ID.
    • logger

      public org.slf4j.Logger logger()
      Description copied from interface: ConfigManager
      Retrieves the delegated logging framework instance.
      Specified by:
      logger in interface ConfigManager
      Returns:
      The SLF4J logger.
    • init

      public void init(Path configDirectory)
      Description copied from interface: ConfigManager
      Allocates primary disk paths and executes initial parsing for CLIENT and GLOBAL scopes.
      Specified by:
      init in interface ConfigManager
      Parameters:
      configDirectory - The root configuration path provided by the platform environment.
    • attachServerConfig

      public void attachServerConfig(net.minecraft.server.MinecraftServer server)
      Description copied from interface: ConfigManager
      Allocates dynamic disk paths and executes parsing for the LEVEL scope tied to the active world instance.
      Specified by:
      attachServerConfig in interface ConfigManager
      Parameters:
      server - The active Minecraft server instance.
    • loadScope

      public void loadScope(ConfigScope targetScope)
      Description copied from interface: ConfigManager
      Forces a synchronous disk read operation for all properties bound to the specified scope.
      Specified by:
      loadScope in interface ConfigManager
      Parameters:
      targetScope - The target synchronization scope.
    • saveScope

      public void saveScope(ConfigScope targetScope)
      Description copied from interface: ConfigManager
      Forces a synchronous disk write operation for all properties bound to the specified scope.
      Specified by:
      saveScope in interface ConfigManager
      Parameters:
      targetScope - The target synchronization scope.
    • load

      public void load()
      Description copied from interface: ConfigManager
      Executes a synchronous disk read across all configuration scopes.
      Specified by:
      load in interface ConfigManager
    • save

      public void save()
      Description copied from interface: ConfigManager
      Executes a synchronous disk write across all configuration scopes.
      Specified by:
      save in interface ConfigManager
    • saveAll

      public CompletableFuture<Void> saveAll()
      Description copied from interface: ConfigManager
      Dispatches an asynchronous disk write operation across all configuration scopes.
      Specified by:
      saveAll in interface ConfigManager
      Returns:
      A CompletableFuture representing the state of the I/O execution.
    • logInfo

      public void logInfo(String message, Object... params)
      Specified by:
      logInfo in interface ConfigManager
    • logWarn

      public void logWarn(String message, Object... params)
      Specified by:
      logWarn in interface ConfigManager
    • logError

      public void logError(String message, Object... params)
      Specified by:
      logError in interface ConfigManager
    • logDebug

      public void logDebug(String message, Object... params)
      Specified by:
      logDebug in interface ConfigManager
    • define

      public Category define(String id)
      Description copied from interface: ConfigManager
      Resolves an existing category or constructs a new structural boundary.
      Specified by:
      define in interface ConfigManager
      Parameters:
      id - The category identifier.
      Returns:
      The bound Category instance.
    • registerGroup

      public Group registerGroup(Category category, String id)
      Description copied from interface: ConfigManager
      Resolves an existing group or constructs a new structural entity within the specified category.
      Specified by:
      registerGroup in interface ConfigManager
      Parameters:
      category - The parent structural boundary.
      id - The group identifier.
      Returns:
      The bound Group instance.
    • registerProperty

      public <T> void registerProperty(Property<T> config)
      Description copied from interface: ConfigManager
      Injects a property into the active configuration memory state and synchronizes it with disk definitions.
      Specified by:
      registerProperty in interface ConfigManager
      Parameters:
      config - The structural property definition.
    • getOrCreateDynamicProperty

      public Property<?> getOrCreateDynamicProperty(ConfigDescription description, DynamicPropertyTypeRegistry.TypeDefinition<?> typeDefinition, Object defaultValue, Object min, Object max)
      Description copied from interface: ConfigManager
      Allocates a dynamic property instance at runtime, matching specific coordinate definitions. Utilized primarily for datapack injection or authoritative server synchronization.
      Specified by:
      getOrCreateDynamicProperty in interface ConfigManager
      Parameters:
      description - The absolute coordinate map.
      typeDefinition - The underlying data class.
      defaultValue - The baseline state value.
      min - The lower validation boundary.
      max - The upper validation boundary.
      Returns:
      The dynamically constructed Property instance.
    • remove

      public void remove(Category category)
      Description copied from interface: ConfigManager
      Executes hierarchical teardown and unbinds a target category and all dependencies.
      Specified by:
      remove in interface ConfigManager
    • remove

      public void remove(Group group)
      Description copied from interface: ConfigManager
      Executes hierarchical teardown and unbinds a target group and all dependencies.
      Specified by:
      remove in interface ConfigManager
    • remove

      public void remove(Property<?> property)
      Description copied from interface: ConfigManager
      Detaches a specific property from the active memory state.
      Specified by:
      remove in interface ConfigManager
    • getCategories

      public List<Category> getCategories()
      Description copied from interface: ConfigManager
      Retrieves all structurally active categories.
      Specified by:
      getCategories in interface ConfigManager
    • getGroupsIn

      public List<Group> getGroupsIn(Category category)
      Description copied from interface: ConfigManager
      Retrieves all structural groups bound to the specific category.
      Specified by:
      getGroupsIn in interface ConfigManager
    • getPropertiesIn

      public List<Property<?>> getPropertiesIn(Group group)
      Description copied from interface: ConfigManager
      Retrieves all properties actively bound to the specified group.
      Specified by:
      getPropertiesIn in interface ConfigManager
    • getConfigDirectory

      public Optional<Path> getConfigDirectory()
      Description copied from interface: ConfigManager
      Retrieves the target disk directory assigned during initialization.
      Specified by:
      getConfigDirectory in interface ConfigManager
    • findProperty

      public Property<?> findProperty(ConfigDescription description)
      Description copied from interface: ConfigManager
      Traverses the active structural hierarchy to resolve a property matching exact logical coordinates.
      Specified by:
      findProperty in interface ConfigManager
      Parameters:
      description - The exact definition map.
      Returns:
      The resolved Property instance, or null if unbound.
    • setScreenFactory

      public void setScreenFactory(Function<Object,Object> factory)
      Description copied from interface: ConfigManager
      Injects a custom screen factory to override default interface rendering protocols. Execute binding prior to platform-specific GUI endpoint registration.
      Specified by:
      setScreenFactory in interface ConfigManager
      Parameters:
      factory - The functional screen construction sequence.
    • createScreen

      public <S> S createScreen(S parent)
      Description copied from interface: ConfigManager
      Triggers dynamic GUI generation for the active configuration hierarchy.
      Specified by:
      createScreen in interface ConfigManager
      Parameters:
      parent - The preceding menu screen entity.
      Returns:
      The constructed configuration screen entity.