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 pluginFolder)Initialize the configuration into the path of plugin folderprotected voidloadCustomDefaultOptions()Load custom default optionsprotected voidloadCustomFileOptions()Load custom config optionsvoidloadDefaultOptions()Load default config options from the resource foldervoidloadFileOptions()Load config options from the already initialized configuration fileprotected voidsaveCustomOptions()Save custom options for sub classesPathsaveDefaultConfigurationFile(@NotNull Path path)Save default configuration file to path folder, if not exists, and return the pathvoidsaveOptions()Save options
-
-
-
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
-
-