-
Notifications
You must be signed in to change notification settings - Fork 0
ConfigManager
The ConfigManager class handles registering, saving, loading, and managing configuration settings for your Minecraft plugin. Every plugin using this library should create its own instance of ConfigManager to manage its configuration files safely.
The easiest way to initialize a manager inside a plugin.
-
plugin: Your plugin instance.
A flexible constructor if you want to specify a custom path or don't have the plugin instance yet (Such as in the Bootstrap)
-
dataFolder: The folder path where config files will be saved and loaded. -
logger: The logger instance used to report file errors.
Registers a new ConfigSetting to this manager.
-
Parameters:
setting- The configuration setting you want to register. - Returns: The registered setting instance.
- Note: Registering is crucial for ConfigSettings, so that they can get initialized.
Removes a specific setting from this manager so it is no longer saved or reloaded.
-
Parameters:
setting– The setting to remove. -
Returns:
trueif the setting was removed, orfalseif it was not found.
Clears cached configuration data and reloads the active values for all registered settings from their respective files.
Writes all registered settings out to their designated YAML files.
- Builds formatted YAML output including comments, setting types, and default values.
- Automatically creates missing directories or files as needed.
Returns the Path to the folder where configuration files are stored.
Returns the Logger instance used by this manager.
Registers a ConfigManager instance to a global list.
-
Parameters:
manager– The manager instance to track globally. - Returns: The same manager instance.
Iterates through all globally registered ConfigManager instances and calls save() on each one.