Interface ConfigRoot
-
public interface ConfigRoot
A configuration root is a representation of where configuration data can be stored, which is ultimately mapped to a directory on disk.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()
andconfig()
, but other or additional configuration files can be stored in the directory returned bydirectory()
(as long as it's not the shared configuration folder).- See Also:
A provider of configuration root
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ConfigurationLoader<CommentedConfigurationNode>
config()
Gets the configuration file that utilizes the default configuration pathname.ConfigurationLoader<CommentedConfigurationNode>
config(ConfigurationOptions options)
Gets the configuration file that utilizes the default configuration pathname.java.nio.file.Path
configPath()
Gets the pathname to the default configuration file for the plugin.java.nio.file.Path
directory()
Gets the directory that this configuration root refers to.
-
-
-
Method Detail
-
configPath
java.nio.file.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:
DefaultConfig
-
config
ConfigurationLoader<CommentedConfigurationNode> 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:
configPath()
-
config
ConfigurationLoader<CommentedConfigurationNode> config(ConfigurationOptions options)
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:
configPath()
-
directory
java.nio.file.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
-
-