Package org.spongepowered.api.config
Interface ConfigManager
-
public interface ConfigManager
Provides configuration for plugins.Plugins can choose between two places to store their configuration:
- A shared configuration folder, which is preferred for plugins with
little configuration. These plugins can simply use
plugin_id.conf
. - A configuration folder specific for the plugin, which is preferred for plugins with a lot of configuration data.
In either case, a "default configuration file" is provided in both scenarios. It is not required that plugins use this, but it does ensure consistency.
Call either
sharedConfig(PluginContainer)
orpluginConfig(PluginContainer)
to get an object that represents one of the two outlined choices. - A shared configuration folder, which is preferred for plugins with
little configuration. These plugins can simply use
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ConfigRoot
pluginConfig(org.spongepowered.plugin.PluginContainer plugin)
Gets the configuration root for a plugin that utilizes a configuration folder specific to the plugin, which may also be a sub-directory of the shared configuration folder.TypeSerializerCollection
serializers()
Get a type serializer collection supporting Sponge types.ConfigRoot
sharedConfig(org.spongepowered.plugin.PluginContainer plugin)
Gets the configuration root for a plugin that utilizes the shared configuration folder.WatchServiceListener
watchServiceListener()
Get a file watch listener using the game executor.
-
-
-
Method Detail
-
sharedConfig
ConfigRoot sharedConfig(org.spongepowered.plugin.PluginContainer plugin)
Gets the configuration root for a plugin that utilizes the shared configuration folder.The shared configuration folder may refer to "config/" but this may vary between implementations and configurations.
The plugin parameter is used to determine the filename for
ConfigRoot.configPath()
.- Parameters:
plugin
- The plugin instance- Returns:
- A shared configuration root
-
pluginConfig
ConfigRoot pluginConfig(org.spongepowered.plugin.PluginContainer plugin)
Gets the configuration root for a plugin that utilizes a configuration folder specific to the plugin, which may also be a sub-directory of the shared configuration folder.The provided plugin is used to determine the folder name.
- Parameters:
plugin
- The plugin instance- Returns:
- A plugin-specific configuration root
-
serializers
TypeSerializerCollection serializers()
Get a type serializer collection supporting Sponge types.This collection is expected to handle:
- Every type built-in to Configurate
ResourceKey
s- Registered implementations of
DataSerializable
- All Adventure types including
Component
- Any type with a
DataTranslator
- Returns:
- A type serializer collection aware of Sponge serializers
-
watchServiceListener
WatchServiceListener watchServiceListener()
Get a file watch listener using the game executor.This can be used to get
auto-reloading references
to configuration files.- Returns:
- The game watch service listener
-
-