Class ConfigurationFile


  • public abstract class ConfigurationFile
    extends Object
    • Field Detail

      • plugin

        @NotNull
        protected final @NotNull ADPPlugin plugin
      • configuration

        protected org.simpleyaml.configuration.file.YamlFile configuration
      • configurationPath

        protected Path configurationPath
    • Constructor Detail

      • ConfigurationFile

        public ConfigurationFile()
    • Method Detail

      • initializeConfiguration

        public void initializeConfiguration​(Path pluginFolder)
        Initialize the configuration into the path of plugin folder
        Parameters:
        pluginFolder - the plugin folder path
      • exists

        public boolean exists()
        Check if configuration file exists
        Returns:
        true if exists
      • saveDefaultConfigurationFile

        public Path saveDefaultConfigurationFile​(@NotNull
                                                 @NotNull Path path)
        Save default configuration file to path folder, if not exists, and return the path
        Parameters:
        path - the file path
        Returns:
        the path of the old or new configuration file
      • saveOptions

        public void saveOptions()
        Save options
      • saveCustomOptions

        protected void saveCustomOptions()
        Save custom options for sub classes
      • loadDefaultOptions

        public void loadDefaultOptions()
        Load default config options from the resource folder
      • loadCustomDefaultOptions

        protected void loadCustomDefaultOptions()
        Load custom default options
      • loadFileOptions

        public void loadFileOptions()
        Load config options from the already initialized configuration file
      • loadCustomFileOptions

        protected void loadCustomFileOptions()
        Load custom config options
      • checkVersion

        public void checkVersion​(boolean autoUpgrade)
        Check the version of the configuration and upgrade it if outdated
        Parameters:
        autoUpgrade - true to auto upgrade configuration file if outdated
      • getFileName

        public abstract String getFileName()
        Get the configuration file name
        Returns:
        the configuration file name
      • getResourceName

        public abstract String getResourceName()
        Get the configuration file path
        Returns:
        the configuration resource name
      • getLatestVersion

        public abstract int getLatestVersion()
        Get latest version of the configuration
        Returns:
        the latest configuration version