java.lang.Object
com.kamikazejam.kamicommon.configuration.standalone.AbstractConfig<T>
Direct Known Subclasses:
KamiConfig, StandaloneConfig

public abstract class AbstractConfig<T extends AbstractYamlConfiguration> extends Object
A class that represents a configuration file
This is an extension of a YamlConfiguration, so all get, set, and put methods are available.

When extending this class, provide the File to the config in the super, and then add all desired comments
Then you can use this object just like a YamlConfiguration, it has all the same methods plus save() and reload()
  • Constructor Details

    • AbstractConfig

      public AbstractConfig()
  • Method Details

    • getFile

      protected abstract File getFile()
      Returns:
      The file associated with this config
    • getYamlConfiguration

      protected abstract T getYamlConfiguration()
      Returns:
      The YamlConfiguration associated with this config
    • reload

      public abstract void reload()
      Reloads the config from the file
    • save

      public boolean save()
      Saves the config to the file
      Returns:
      IFF the config was saved (can be skipped if no changes were made)
    • save

      public boolean save(boolean force)
      Saves the config to the file
      Parameters:
      force - If the config should be saved even if no changes were made
      Returns:
      IFF the config was saved (can be skipped if no changes were made and force is false)
    • isChanged

      public boolean isChanged()
      Returns:
      If this config has detected changes to its structure that need saving
    • setChanged

      @Internal public void setChanged(boolean changed)