From 75c5f1fa463caac9e37d9f8d983a66ab0cdeac60 Mon Sep 17 00:00:00 2001 From: me4502 Date: Tue, 12 Feb 2013 20:04:13 +1000 Subject: [PATCH] Make the getList related things in YAMLProcessor w rite defaults. This fixes an issue in plugins that use this config system, where they are sometimes not written. Most noticable in CraftBook, where all String Lists are not written to the config file. --- src/main/java/com/sk89q/util/yaml/YAMLNode.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/sk89q/util/yaml/YAMLNode.java b/src/main/java/com/sk89q/util/yaml/YAMLNode.java index fea3b104d..c9893c866 100644 --- a/src/main/java/com/sk89q/util/yaml/YAMLNode.java +++ b/src/main/java/com/sk89q/util/yaml/YAMLNode.java @@ -443,6 +443,7 @@ public class YAMLNode { public List getStringList(String path, List def) { List raw = getList(path); if (raw == null) { + if (writeDefaults && def != null) setProperty(path, def); return def != null ? def : new ArrayList(); } @@ -472,6 +473,7 @@ public class YAMLNode { public List getIntList(String path, List def) { List raw = getList(path); if (raw == null) { + if (writeDefaults && def != null) setProperty(path, def); return def != null ? def : new ArrayList(); } @@ -500,6 +502,7 @@ public class YAMLNode { public List getDoubleList(String path, List def) { List raw = getList(path); if (raw == null) { + if (writeDefaults && def != null) setProperty(path, def); return def != null ? def : new ArrayList(); } @@ -528,6 +531,7 @@ public class YAMLNode { public List getBooleanList(String path, List def) { List raw = getList(path); if (raw == null) { + if (writeDefaults && def != null) setProperty(path, def); return def != null ? def : new ArrayList(); } @@ -651,6 +655,7 @@ public class YAMLNode { public List getNodeList(String path, List def) { List raw = getList(path); if (raw == null) { + if (writeDefaults && def != null) setProperty(path, def); return def != null ? def : new ArrayList(); }