Update to Minecraft 1.19.4

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2023-03-15 03:30:00 +11:00
parent 86d3c9caa7
commit b76cbe36c5
32 changed files with 1379 additions and 7 deletions

View File

@@ -56,16 +56,16 @@ public class YamlConfiguration extends FileConfiguration {
private final Yaml yaml;
public YamlConfiguration() {
constructor = new YamlConstructor();
representer = new YamlRepresenter();
representer.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
yamlDumperOptions = new DumperOptions();
yamlDumperOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
yamlLoaderOptions = new LoaderOptions();
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
constructor = new YamlConstructor(yamlLoaderOptions);
representer = new YamlRepresenter(yamlDumperOptions);
representer.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
yaml = new Yaml(constructor, representer, yamlDumperOptions, yamlLoaderOptions);
}

View File

@@ -5,6 +5,7 @@ import java.util.Map;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.constructor.SafeConstructor;
import org.yaml.snakeyaml.error.YAMLException;
import org.yaml.snakeyaml.nodes.MappingNode;
@@ -13,7 +14,16 @@ import org.yaml.snakeyaml.nodes.Tag;
public class YamlConstructor extends SafeConstructor {
/**
* @deprecated options required
*/
@Deprecated
public YamlConstructor() {
this(new LoaderOptions());
}
public YamlConstructor(@NotNull LoaderOptions loaderOptions) {
super(loaderOptions);
this.yamlConstructors.put(Tag.MAP, new ConstructCustomObject());
}

View File

@@ -6,12 +6,22 @@ import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
import org.jetbrains.annotations.NotNull;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.representer.Representer;
public class YamlRepresenter extends Representer {
/**
* @deprecated options required
*/
@Deprecated
public YamlRepresenter() {
this(new DumperOptions());
}
public YamlRepresenter(@NotNull DumperOptions options) {
super(options);
this.multiRepresenters.put(ConfigurationSection.class, new RepresentConfigurationSection());
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