Package dev.demeng.pluginbase
Class YamlConfig
java.lang.Object
dev.demeng.pluginbase.YamlConfig
A standard YAML configuration file with several shortcuts to common methods including such as
reloading or saving.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisOutdated(int currentVersion) Checks if the config version integer equals or is less than the current version.voidreload()Reloads the configuration file.voidsave()Saves the configuration file (after making edits).
-
Constructor Details
-
YamlConfig
public YamlConfig(String name) throws org.bukkit.configuration.InvalidConfigurationException, IOException Loads a YAML configuration file. If the file does not exist, a new file will be copied from the project's resources folder.- Parameters:
name- The name of the config, ending in .yml- Throws:
org.bukkit.configuration.InvalidConfigurationException- If there was a formatting/parsing error in the configIOException- If the file could not be created and/or loaded
-
-
Method Details
-
reload
Reloads the configuration file.- Throws:
org.bukkit.configuration.InvalidConfigurationException- If there was a formatting/parsing error in the configIOException- If the file could not be reloaded
-
save
Saves the configuration file (after making edits).- Throws:
IOException- If the file could not be saved
-
isOutdated
public boolean isOutdated(int currentVersion) Checks if the config version integer equals or is less than the current version.- Parameters:
currentVersion- The expected value of the config version- Returns:
- True if the config is outdated, false otherwise
-