Class YamlConfig
java.lang.Object
fr.hytale.loader.config.BaseConfig
fr.hytale.loader.config.YamlConfig
- All Implemented Interfaces:
Config
YAML-based configuration implementation.
This class handles parsing and generating YAML files for configuration
storage.
It extends BaseConfig to leverage the common configuration logic.
The YAML parser is simple and supports standard YAML constructs like key-value pairs, nested maps, and lists.
- Since:
- 1.0.4
- Version:
- 1.0.4
- Author:
- HytaleLoader
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class BaseConfig
BaseConfig.MapConfigSection -
Field Summary
Fields inherited from class BaseConfig
data, defaults, file -
Constructor Summary
ConstructorsConstructorDescriptionYamlConfig(File file) Creates a new YAML configuration linked to the specified file. -
Method Summary
Methods inherited from class BaseConfig
addDefault, applyDefaults, contains, get, get, getBoolean, getBoolean, getDouble, getDouble, getFile, getFromDefaults, getInt, getInt, getKeys, getKeysFromMap, getList, getList, getSection, getString, getString, getStringList, getValues, set, setDefaults
-
Constructor Details
-
YamlConfig
Creates a new YAML configuration linked to the specified file.- Parameters:
file- the configuration file (usually ending in .yml)
-
-
Method Details
-
save
Saves the current configuration data to the file in YAML format.Creates parent directories if they do not exist.
- Throws:
IOException- if an error occurs while writing to the file
-
reload
Reloads the configuration from the file.This clears the current data and re-parses the file. If the file does not exist but defaults are set, it creates the file with the default values.
- Throws:
IOException- if an error occurs while reading the file
-