Class YamlConfig

java.lang.Object
dev.demeng.pluginbase.YamlConfig

public class YamlConfig extends Object
A standard YAML configuration file with several shortcuts to common methods including such as reloading or saving.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Loads a YAML configuration file.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isOutdated(int currentVersion)
    Checks if the config version integer equals or is less than the current version.
    void
    Reloads the configuration file.
    void
    Saves the configuration file (after making edits).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 config
      IOException - If the file could not be created and/or loaded
  • Method Details

    • reload

      public void reload() throws org.bukkit.configuration.InvalidConfigurationException, IOException
      Reloads the configuration file.
      Throws:
      org.bukkit.configuration.InvalidConfigurationException - If there was a formatting/parsing error in the config
      IOException - If the file could not be reloaded
    • save

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