9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

Disable yaml duplicate keys warning by default

This commit is contained in:
Dreeam
2025-12-16 05:48:04 -05:00
parent 6aba8c86ca
commit 6129df4281

View File

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