Class ConfigurationFile
- java.lang.Object
-
- com.alessiodp.core.common.configuration.ConfigurationFile
-
public abstract class ConfigurationFile extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected org.simpleyaml.configuration.file.YamlFileconfigurationprotected PathconfigurationPathprotected @NotNull ADPPluginplugin
-
Constructor Summary
Constructors Constructor Description ConfigurationFile()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcheckVersion(boolean autoUpgrade)Check the version of the configuration and upgrade it if outdatedbooleanexists()Check if configuration file existsabstract StringgetFileName()Get the configuration file nameabstract intgetLatestVersion()Get latest version of the configurationabstract StringgetResourceName()Get the configuration file pathvoidinitializeConfiguration(Path folder)Initialize the configurationvoidloadConfigOptions()Load config optionsabstract voidloadConfiguration()Load configuration from given configuration adaptervoidloadDefaultConfigOptions()Load default config optionsabstract voidloadDefaults()Load default valuesvoidsave()Save configurationPathsaveDefaultConfiguration(@NotNull Path path)Save default configuration to path
-
-
-
Method Detail
-
saveDefaultConfiguration
public Path saveDefaultConfiguration(@NotNull @NotNull Path path)
Save default configuration to path- Parameters:
path- the file path- Returns:
- the same path
-
exists
public boolean exists()
Check if configuration file exists- Returns:
- true if exists
-
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
-
loadDefaults
public abstract void loadDefaults()
Load default values
-
initializeConfiguration
public void initializeConfiguration(Path folder)
Initialize the configuration- Parameters:
folder- the plugin folder path
-
loadConfiguration
public abstract void loadConfiguration()
Load configuration from given configuration adapter
-
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
-
loadDefaultConfigOptions
public void loadDefaultConfigOptions()
Load default config options
-
loadConfigOptions
public void loadConfigOptions()
Load config options
-
save
public void save()
Save configuration
-
-