1.15.2 Spigot/Paper NoSuchMethodError YamlCompat fix (#3242)

This commit is contained in:
lixfel 2023-03-14 21:48:40 +01:00 committed by GitHub
parent 27ee6f519e
commit 18b41c82c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,7 +46,12 @@ public abstract class Config implements ConfigurationProvider {
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
options.setPrettyFlow(false);
options.setIndent(2);
return new Yaml(YAMP_COMPAT.createSafeConstructor(), YAMP_COMPAT.createRepresenter(options), options);
try {
return new Yaml(YAMP_COMPAT.createSafeConstructor(), YAMP_COMPAT.createRepresenter(options), options);
} catch (NoSuchMethodError e) {
YamlCompat compat = new Yaml1Compat();
return new Yaml(compat.createSafeConstructor(), compat.createRepresenter(options), options);
}
});
private final CommentStore commentStore = new CommentStore('.', 2);