Skip to content

Commit

Permalink
Add worldedit runtime environment to increase yaml alias limit
Browse files Browse the repository at this point in the history
This can be set by -Dworldedit.yaml.aliasLimit=XXX in the startup parameter
  • Loading branch information
Joo200 committed Sep 11, 2023
1 parent 18cc29a commit d1e7c13
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,16 @@ public YAMLProcessor(File file, boolean writeDefaults, YAMLFormat format) {
representer.setDefaultFlowStyle(format.getStyle());
LoaderOptions loaderOptions = new LoaderOptions();
try {
int yamlAliasLimit = Integer.getInteger("worldedit.yaml.aliasLimit", 50);
loaderOptions.setMaxAliasesForCollections(yamlAliasLimit);
// 64 MB default
int yamlCodePointLimit = Integer.getInteger("worldedit.yaml.codePointLimit", 64 * 1024 * 1024);
loaderOptions.setCodePointLimit(yamlCodePointLimit);
} catch (NoSuchMethodError ignored) {
// pre-1.32 snakeyaml
}

yaml = new Yaml(new SafeConstructor(new LoaderOptions()), representer, dumperOptions, loaderOptions);
yaml = new Yaml(new SafeConstructor(loaderOptions), representer, dumperOptions, loaderOptions);

this.file = file;
}
Expand Down

0 comments on commit d1e7c13

Please sign in to comment.