Closed dasavick closed 2 years ago
Fixed in https://github.com/OkaeriPoland/okaeri-configs/commit/735057e309bcfd9bfea3f7846b129d8d29957e9e (4.0.0-beta21
). Orphan removal is performed pre-save (after sorting) and is disabled by default.
/**
* Sets the state of automatic orphan removal
* - True: orphaned keys would be explicitly removed
* - False: it is up to configurer to manage orphaned keys
*
* @param removeOrphans new state
* @return this instance
*/
public OkaeriConfig withRemoveOrphans(boolean removeOrphans) {
this.setRemoveOrphans(removeOrphans);
return this;
}
TestConfig config = ConfigManager.create(TestConfig.class, (it) -> {
it.withConfigurer(new YamlBukkitConfigurer(), new SerdesBukkit()); // specify configurer implementation, optionally additional serdes packages
it.withBindFile("config.yml"); // specify Path, File or pathname
it.withRemoveOrphans(true); // <---------
it.saveDefaults(); // save file if does not exists
it.load(true); // load and save to update comments/new fields
});
Affected:
Not affected: