Class AbstractConfig

java.lang.Object
nl.pim16aap2.animatedarchitecture.core.config.AbstractConfig
All Implemented Interfaces:
IRestartable, IConfig

public abstract class AbstractConfig extends Object implements IConfig
The base configuration class for Animated Architecture.

All shared configuration settings should be defined here. Subclasses can add platform-/version-specific settings.

  • Constructor Details

    • AbstractConfig

      protected AbstractConfig(@Named("pluginBaseDirectory") Path baseDir)
  • Method Details

    • isOldConfigPresent

      public boolean isOldConfigPresent()
      Description copied from interface: IConfig
      Returns whether the old configuration file (config.yml) exists.

      If it does, it means the user has not yet migrated their configuration to the new format (config.yaml).

      This value is re-evaluated on each config reload, so it reflects the current state of the file system.

      Specified by:
      isOldConfigPresent in interface IConfig
      Returns:
      True if the old configuration file currently exists.
    • initialVersion

      protected abstract int initialVersion()
      Gets the initial version of the configuration file.
      Returns:
      The initial version of the configuration file.
    • parseConfig

      protected final void parseConfig(boolean silent)
      Parses the configuration file and applies any necessary transformations.

      If the configuration file does not exist, it will be created with default values.

      Parameters:
      silent - When true, the method will not log any informational/status messages when parsing the results.
    • getHeader

      protected String getHeader()
      Gets the header for the configuration file.
      Returns:
      The header text for the configuration file.
    • addSections

      protected void addSections(ConfigSection<?>... sections)
      Adds one or more configuration sections to the configuration.
      Parameters:
      sections - The configuration sections to add.
    • getSections

      protected List<ConfigSection<?>> getSections()
      Gets the list of configuration sections.
      Returns:
      A list of configuration sections.
    • addTransformations

      protected void addTransformations(org.spongepowered.configurate.transformation.ConfigurationTransformation.VersionedBuilder builder)
      Adds additional transformations to the configuration.

      This method can be overridden by subclasses to add their own transformations.

      Parameters:
      builder - The builder to add transformations to.
    • toString

      public @NonNull String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(@Nullable Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • configPath

      public Path configPath()