SPIGOT-6234: enum classes don't serialize properly when implementing ConfigurationSerializable

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2020-11-17 12:56:36 +11:00
parent 39f6cd7ffa
commit 139ca6a269
4 changed files with 27 additions and 3 deletions

View File

@@ -14,6 +14,9 @@ public class YamlRepresenter extends Representer {
public YamlRepresenter() {
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
// So instead we will just allow future plugins to have their enums extend ConfigurationSerializable
this.multiRepresenters.remove(Enum.class);
}
private class RepresentConfigurationSection extends RepresentMap {