mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-01-10 17:57:37 +00:00
Improved formatting and performance of YAMLProcessor when no comments are present
This commit is contained in:
parent
a7c75285d9
commit
29fd98879d
@ -183,20 +183,24 @@ public class YAMLProcessor extends YAMLNode {
|
|||||||
writer.append(header);
|
writer.append(header);
|
||||||
writer.append(LINE_BREAK);
|
writer.append(LINE_BREAK);
|
||||||
}
|
}
|
||||||
// Iterate over each root-level property and dump
|
if (comments.size() == 0) {
|
||||||
for (Iterator<Map.Entry<String, Object>> i = root.entrySet().iterator(); i.hasNext();) {
|
yaml.dump(root, writer);
|
||||||
Map.Entry<String, Object> entry = i.next();
|
} 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
|
// Output comment, if present
|
||||||
String comment = comments.get(entry.getKey());
|
String comment = comments.get(entry.getKey());
|
||||||
if (comment != null) {
|
if (comment != null) {
|
||||||
writer.append(LINE_BREAK);
|
writer.append(LINE_BREAK);
|
||||||
writer.append(comment);
|
writer.append(comment);
|
||||||
writer.append(LINE_BREAK);
|
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;
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user