Updated Upstream (Bukkit/CraftBukkit) (#7776)

This commit is contained in:
Shane Freeder
2022-04-30 17:27:41 +01:00
parent 8d72e2dfb2
commit 655a3cf961
10 changed files with 71 additions and 59 deletions

View File

@@ -22,30 +22,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
protected FileConfigurationOptions(@NotNull MemoryConfiguration configuration) {
super(configuration);
diff --git a/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java b/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java
+++ b/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java
@@ -0,0 +0,0 @@ import org.yaml.snakeyaml.representer.Representer;
public class YamlRepresenter extends Representer {
public YamlRepresenter() {
+ this.multiRepresenters.put(org.bukkit.configuration.ConfigurationSection.class, new RepresentConfigurationSection()); // Paper - restore old yaml config section representer
this.multiRepresenters.put(ConfigurationSerializable.class, new RepresentConfigurationSerializable());
// SPIGOT-6234: We could just switch YamlConstructor to extend Constructor rather than SafeConstructor, however there is a very small risk of issues with plugins treating config as untrusted input
// So instead we will just allow future plugins to have their enums extend ConfigurationSerializable
this.multiRepresenters.remove(Enum.class);
}
+ // Paper start - restore old yaml config section representer
+ private class RepresentConfigurationSection extends RepresentMap {
+
+ @NotNull
+ @Override
+ public Node representData(@NotNull Object data) {
+ return super.representData(((org.bukkit.configuration.ConfigurationSection) data).getValues(false));
+ }
+ }
+ // Paper end
private class RepresentConfigurationSerializable extends RepresentMap {