Class ConfigManager

java.lang.Object
org.kingdoms.config.managers.ConfigManager

public final class ConfigManager extends Object
  • Constructor Details

    • ConfigManager

      @Internal public ConfigManager(Kingdoms plugin)
  • Method Details

    • beforeWrite

      public static void beforeWrite(YamlContainer adapter)
    • getMainConfigs

      public static @Unmodifiable Collection<YamlResource> getMainConfigs()
      Returns an immutable list of main configuration files. A config file is a main config if it's a simple, ungrouped file in the Kingdoms plugins directory. Configs such as language files, GUIs or custom dynamic files (like turrets/structures style configs) are not considered main configs.

      Main config files are generally used for reloading inside /k reload command and also searching using /k admin searchConfig command. They can also be included in the experimental ConfigMigrationHistory feature.

      See Also:
    • registerAsMainConfig

      public static void registerAsMainConfig(YamlResource yml)
      Registers as a main config file. Read getMainConfigs() for more info.
    • setupReloadHandles

      @Internal public void setupReloadHandles()
    • setupWatchService

      @Internal public void setupWatchService()
    • addAllConfigs

      @Internal public static void addAllConfigs()
    • registerNormalWatcher

      public static void registerNormalWatcher(String normalRelativePath, FileWatcher watcher)
    • watch

      public static void watch(YamlContainer yaml)
      Watch this config file for changes to automatically reload using YamlContainer.reloadHandle() This will only work for files inside the Kingdoms folder.
    • standardReload

      public static void standardReload(YamlContainer config, ConfigManager.ConfigReloadType reloadType)
    • standardReload

      public static void standardReload(YamlContainer config, ConfigManager.ConfigReloadType reloadType, Function<String,String> customMessage)
      Does the following according to a message to the rules defined in configs:

      YamlContainer.reload() - YamlContainer.reloadHandle() - YamlWithDefaults.validate() - YamlWithDefaults.update()

      Note: This method should not be used inside YamlContainer.reloadHandle() as it will cause a StackOverflowError.

    • generateSchema

      @Internal @TestOnly public void generateSchema()
    • onDisable

      @Internal public static void onDisable()
    • warnAboutValidation

      @Internal public static void warnAboutValidation(String name, List<org.snakeyaml.validation.ValidationFailure> exceptions)
    • validateConfigs

      public void validateConfigs()
    • updateConfigs

      public static void updateConfigs()
    • createDataFolderIfMissing

      @Internal public void createDataFolderIfMissing()