Changed configuration saving so empty lists will be added to the configuration files.

This commit is contained in:
sk89q 2011-06-27 12:09:03 -07:00
parent 53d6a272e6
commit 0863db8cf0
2 changed files with 25 additions and 4 deletions

View File

@ -1,3 +1,7 @@
5.2.2:
- Changed configuration saving so empty lists will be added to
the configuration files.
5.2.1: 5.2.1:
- Add region bounds to /region info - Add region bounds to /region info
- Added the ability to add owners/members to the global region for - Added the ability to add owners/members to the global region for

View File

@ -29,6 +29,7 @@
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -201,19 +202,35 @@ private double getDouble(String node, double def) {
} }
private List<Integer> getIntList(String node, List<Integer> def) { private List<Integer> getIntList(String node, List<Integer> def) {
List<Integer> res;
if (config.getProperty(node) != null) { if (config.getProperty(node) != null) {
return config.getIntList(node, def); res = config.getIntList(node, def);
} else { } else {
return parentConfig.getIntList(node, def); res = parentConfig.getIntList(node, def);
} }
if (res == null || res.size() == 0) {
parentConfig.setProperty(node, new ArrayList<Integer>());
}
return res;
} }
private List<String> getStringList(String node, List<String> def) { private List<String> getStringList(String node, List<String> def) {
List<String> res;
if (config.getProperty(node) != null) { if (config.getProperty(node) != null) {
return config.getStringList(node, def); res = config.getStringList(node, def);
} else { } else {
return parentConfig.getStringList(node, def); res = parentConfig.getStringList(node, def);
} }
if (res == null || res.size() == 0) {
parentConfig.setProperty(node, new ArrayList<String>());
}
return res;
} }
/** /**