Interface ConfigRoot
The underlying directory may refer to a shared directory (shared
by many plugins) or one that is specific to a plugin. Be mindful
of simply storing data in directory()
depending on the
type of configuration root.
A default configuration file is provided via both
configPath()
and config()
, but other or additional
configuration files can be stored in the directory returned by
directory()
(as long as it's
not the shared configuration folder).
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionconfig()
Gets the configuration file that utilizes the default configuration pathname.config
(ConfigurationOptions options) Gets the configuration file that utilizes the default configuration pathname.Gets the pathname to the default configuration file for the plugin.Gets the directory that this configuration root refers to.
-
Method Details
-
configPath
Path configPath()Gets the pathname to the default configuration file for the plugin.If the configuration root is shared, then the returned pathname will refer to the path
$config/$plugin_id.conf
(where "$config" is the shared configuration directory). Otherwise, the returned pathname will refer to a file named "config.conf" stored in a directory specific to the plugin.The returned pathname may refer to a file that does not yet exist. It is up to the caller of this method to create the file if desired.
- Returns:
- A file, which may not yet exist
- See Also:
-
config
Gets the configuration file that utilizes the default configuration pathname.The returned loader will default to using options that:
- Copy default values to the configuration
- Implicitly initialize values (so will provide an empty value if no default is provided)
- Use the Sponge default
TypeSerializers
, as described inConfigManager.serializers()
.
- Returns:
- A configuration object
- See Also:
-
config
Gets the configuration file that utilizes the default configuration pathname.The returned loader will default to using the provided options.
- Parameters:
options
- Default options to be used when loading- Returns:
- A configuration object
- See Also:
-
directory
Path directory()Gets the directory that this configuration root refers to.The returned pathname may not refer to a directory that exists yet.
- Returns:
- A directory
-