Class Configurations

java.lang.Object
com.codingchili.core.files.Configurations

public abstract class Configurations extends Object

Handles loading and parsing of the configuration files.

  • Constructor Details

    • Configurations

      public Configurations()
  • Method Details

    • get

      public static <T extends Configurable> T get(String path, Class<T> clazz)
      Loads a configurable from specified path and instantiates a settings object.
      Type Parameters:
      T - type of the configurable bound by clazz
      Parameters:
      path - the path to the json configuration.
      clazz - a class with settings that extends a Configurable.
      Returns:
      an instantiated configurable.
    • put

      public static void put(Configurable configurable)
      Inserts a configuration file from memory into the configuration store.
      Parameters:
      configurable - the configurable to be stored.
    • reset

      public static void reset()
    • override

      public static String override(String rootDir, String overrideDir, String filePath)
      Checks if an alternate file with the same name exists in another folder.
      Parameters:
      rootDir - The root dir is the union of the path and override.
      filePath - The file to check if exists in another directory.
      overrideDir - The other directory to check in.
      Returns:
      a path to the overridden resource if exists or the filePath itself.
    • loaded

      public static Collection<Configurable> loaded()
      Get all loaded configurables, useful for modifying them before saving.
      Returns:
      a list of all the configurables loaded.
    • available

      public static Collection<String> available(String path)
      List all available configuration files.
      Parameters:
      path - root path to search from.
      Returns:
      a list of paths to configuration files.
    • system

      public static SystemSettings system()
      Returns:
      system settings stored in the cache.
    • security

      public static SecuritySettings security()
      Returns:
      security settings from the cache.
    • launcher

      public static LauncherSettings launcher()
      Returns:
      launcher settings stored in the cache.
    • storage

      public static StorageSettings storage()
      Returns:
      storage settings stored in the cache.
    • storage

      public static RemoteStorage storage(Class<?> plugin)
      Parameters:
      plugin - the plugin to get configurations for.
      Returns:
      storage settings for the given plugin