16.7_dev-3 repo release
ConfigWriter - add List & "" to String - fix forceSet
This commit is contained in:
@@ -34,10 +34,10 @@ public class T2CconfigWriter {
|
||||
config = YamlConfiguration.loadConfiguration(configFile);
|
||||
Map<String, List<String>> comments = new LinkedHashMap<>();
|
||||
|
||||
for (T2CconfigItem value : values) {
|
||||
if ((value.getForceSet() && exist) || (!exist && !value.getForceSet())) {
|
||||
config.addDefault(value.getPath(), value.getValue());
|
||||
comments.put(value.getPath(), value.getComments());
|
||||
for (T2CconfigItem item : values) {
|
||||
if (item.getForceSet() || !exist) {
|
||||
config.addDefault(item.getPath(), item.getValue());
|
||||
comments.put(item.getPath(), item.getComments());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,19 @@ public class T2CconfigWriter {
|
||||
addSection((ConfigurationSection) value, comments, builder, fullKey, indentLevel + 1);
|
||||
} else {
|
||||
// Add value with proper indentation
|
||||
builder.append(indent).append(key).append(": ").append(value).append("\n");
|
||||
if (value instanceof List) {
|
||||
builder.append(indent).append(key).append(": ").append("\n");
|
||||
List<Object> zw = (List<Object>) value;
|
||||
for (Object s : zw) {
|
||||
if (s instanceof String) {
|
||||
builder.append(indent).append("- \"").append(s).append("\"\n");
|
||||
} else builder.append(indent).append("- ").append(s).append("\n");
|
||||
}
|
||||
} else {
|
||||
if (value instanceof String) {
|
||||
builder.append(indent).append(key).append(": \"").append(value).append("\"\n");
|
||||
} else builder.append(indent).append(key).append(": ").append(value).append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user