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)
or
pluginConfig(PluginContainer)
to get an object that represents one of
the two outlined choices.
-
Method Summary
Modifier and TypeMethodDescriptionpluginConfig
(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.Get a type serializer collection supporting Sponge types.sharedConfig
(org.spongepowered.plugin.PluginContainer plugin) Gets the configuration root for a plugin that utilizes the shared configuration folder.Get a file watch listener using the game executor.
-
Method Details
-
pluginConfig
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