Class CommentConfigManager
java.lang.Object
com.github.pinont.singularitylib.api.manager.CommentConfigManager
A comment-preserving, auto-updating configuration manager (Phase 2 upgrade).
Unlike ConfigManager (plain YamlConfiguration), this class:
- Preserves inline comments and section headers when saving.
- Merges missing defaults from a bundled resource WITHOUT destroying user edits.
- Exposes a
mergeDefaults(Map)API and auto-merges on first load.
Comment model: a path -> comment map. When a key is saved the comment is
emitted above it. Keys without comments render plain.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAttaches a comment to a path (emitted above that key on save).booleangetBoolean(String path, boolean def) org.bukkit.configuration.file.YamlConfigurationintbooleanmergeDefaults(Map<String, Object> defaults) Merges missing defaults from the given map into the config (existing user values win).voidsave()Saves to disk with comments preserved.voidSets a value and saves (preserving comments).
-
Constructor Details
-
CommentConfigManager
- Parameters:
plugin- owning pluginfileName- config file name under the plugin data folder
-
-
Method Details
-
comment
Attaches a comment to a path (emitted above that key on save).- Parameters:
path- the dotted config pathcomment- the comment text (without '#')- Returns:
- this manager for chaining
-
set
-
get
-
getBoolean
-
getInt
-
getString
-
mergeDefaults
-
save
public void save()Saves to disk with comments preserved. -
getConfig
public org.bukkit.configuration.file.YamlConfiguration getConfig()- Returns:
- the underlying Bukkit configuration (read-only access recommended)
-