Package com.codingchili.core.files
Class Configurations
java.lang.Object
com.codingchili.core.files.Configurations
Handles loading and parsing of the configuration files.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<String>
List all available configuration files.static <T extends Configurable>
TLoads a configurable from specified path and instantiates a settings object.static LauncherSettings
launcher()
static Collection<Configurable>
loaded()
Get all loaded configurables, useful for modifying them before saving.static String
Checks if an alternate file with the same name exists in another folder.static void
put(Configurable configurable)
Inserts a configuration file from memory into the configuration store.static void
reset()
static SecuritySettings
security()
static StorageSettings
storage()
static RemoteStorage
static SystemSettings
system()
-
Constructor Details
-
Configurations
public Configurations()
-
-
Method Details
-
get
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
Inserts a configuration file from memory into the configuration store.- Parameters:
configurable
- the configurable to be stored.
-
reset
public static void reset() -
override
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
Get all loaded configurables, useful for modifying them before saving.- Returns:
- a list of all the configurables loaded.
-
available
List all available configuration files.- Parameters:
path
- root path to search from.- Returns:
- a list of paths to configuration files.
-
system
- Returns:
- system settings stored in the cache.
-
security
- Returns:
- security settings from the cache.
-
launcher
- Returns:
- launcher settings stored in the cache.
-
storage
- Returns:
- storage settings stored in the cache.
-
storage
- Parameters:
plugin
- the plugin to get configurations for.- Returns:
- storage settings for the given plugin
-