Class YamlConfig

java.lang.Object
fr.hytale.loader.config.BaseConfig
fr.hytale.loader.config.YamlConfig
All Implemented Interfaces:
Config

public class YamlConfig extends BaseConfig
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:
  • Constructor Details

    • YamlConfig

      public YamlConfig(File file)
      Creates a new YAML configuration linked to the specified file.
      Parameters:
      file - the configuration file (usually ending in .yml)
  • Method Details

    • save

      public void save() throws IOException
      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

      public void reload() throws IOException
      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