SPIGOT-6830: Fix addDefaults with Configuration overrides child Sections in the defaults

By: Wolf2323 <gabrielpatrikurban@gmail.com>
This commit is contained in:
Bukkit/Spigot
2021-12-04 21:38:45 +01:00
parent 36fb1f9c00
commit 3ddde21487
2 changed files with 42 additions and 1 deletions

View File

@@ -54,7 +54,11 @@ public class MemoryConfiguration extends MemorySection implements Configuration
public void addDefaults(@NotNull Configuration defaults) {
Validate.notNull(defaults, "Defaults may not be null");
addDefaults(defaults.getValues(true));
for (String key : defaults.getKeys(true)) {
if (!defaults.isConfigurationSection(key)) {
addDefault(key, defaults.get(key));
}
}
}
@Override