|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | + |
| 3 | +Date: Tue, 16 Dec 2025 04:44:10 -0500 |
| 4 | +Subject: [PATCH] Disable yaml duplicate keys warning by default |
| 5 | + |
| 6 | +Disable Yaml's warnOnDuplicateKeys by deafault to |
| 7 | +follow the original behavior |
| 8 | + |
| 9 | +It's just a warning output introduced since snakeyaml 2.4, |
| 10 | +See https://github.com/snakeyaml/snakeyaml/commit/b16f9485f33136fb30f8472f3ccf0209707c023e |
| 11 | + |
| 12 | +The comment of LoaderOptions#setWarnOnDuplicateKeys is |
| 13 | +actually misleading, since this warnOnDuplicateKeys option |
| 14 | +is enabled by default when creates new Yaml instance |
| 15 | + |
| 16 | + |
| 17 | +diff --git a/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java b/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java |
| 18 | +index ed81e850b22b83ac872707daf3c7d5d0cac6176b..c4fab5b8b3eb5f52c7ec88ed70fc85996cc04554 100644 |
| 19 | +--- a/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java |
| 20 | ++++ b/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java |
| 21 | +@@ -62,6 +62,7 @@ public class YamlConfiguration extends FileConfiguration { |
| 22 | + yamlLoaderOptions.setMaxAliasesForCollections(Integer.MAX_VALUE); // SPIGOT-5881: Not ideal, but was default pre SnakeYAML 1.26 |
| 23 | + yamlLoaderOptions.setCodePointLimit(Integer.MAX_VALUE); // SPIGOT-7161: Not ideal, but was default pre SnakeYAML 1.32 |
| 24 | + yamlLoaderOptions.setNestingDepthLimit(100); // SPIGOT-7906: The default limit (50) can be easily reached with nested bundles |
| 25 | ++ yamlLoaderOptions.setWarnOnDuplicateKeys(false); // Leaf - Disable yaml duplicate keys warning by default |
| 26 | + |
| 27 | + constructor = new YamlConstructor(yamlLoaderOptions); |
| 28 | + representer = new YamlRepresenter(yamlDumperOptions); |
0 commit comments