3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 11:00:05 +01:00

Improved formatting and performance of YAMLProcessor when no comments are present

Dieser Commit ist enthalten in:
zml2008 2012-01-24 15:21:44 -08:00
Ursprung a7c75285d9
Commit 29fd98879d

Datei anzeigen

@ -183,20 +183,24 @@ public class YAMLProcessor extends YAMLNode {
writer.append(header);
writer.append(LINE_BREAK);
}
// Iterate over each root-level property and dump
for (Iterator<Map.Entry<String, Object>> i = root.entrySet().iterator(); i.hasNext();) {
Map.Entry<String, Object> entry = i.next();
if (comments.size() == 0) {
yaml.dump(root, writer);
} else {
// Iterate over each root-level property and dump
for (Iterator<Map.Entry<String, Object>> i = root.entrySet().iterator(); i.hasNext(); ) {
Map.Entry<String, Object> entry = i.next();
// Output comment, if present
String comment = comments.get(entry.getKey());
if (comment != null) {
writer.append(LINE_BREAK);
writer.append(comment);
writer.append(LINE_BREAK);
// Output comment, if present
String comment = comments.get(entry.getKey());
if (comment != null) {
writer.append(LINE_BREAK);
writer.append(comment);
writer.append(LINE_BREAK);
}
// Dump property
yaml.dump(Collections.singletonMap(entry.getKey(), entry.getValue()), writer);
}
// Dump property
yaml.dump(Collections.singletonMap(entry.getKey(), entry.getValue()), writer);
}
return true;
} catch (IOException e) {