special characters in lists fix, empty list fix

This commit is contained in:
Tyler Murphy 2022-05-06 09:00:46 -04:00
parent 651d0c5a54
commit 1b0985710c

View file

@ -247,13 +247,16 @@ public class ConfigManager {
if(end == -1) end = yamlString.length(); if(end == -1) end = yamlString.length();
StringBuilder replace = new StringBuilder(new String("".getBytes(), StandardCharsets.UTF_8)); StringBuilder replace = new StringBuilder(new String("".getBytes(), StandardCharsets.UTF_8));
if(entry.getValue() instanceof List){ if(entry.getValue() instanceof List){
if(((List<?>) entry.getValue()).isEmpty()) continue; if(((List<?>) entry.getValue()).isEmpty()){
replace.append("["); replace.append("[]");
for(Object o : (List<?>)entry.getValue()){ } else {
replace.append(new String(o.toString().getBytes(), StandardCharsets.UTF_8)).append(", "); replace.append("[");
for (Object o : (List<?>) entry.getValue()) {
replace.append(o.toString()).append(", ");
}
replace = new StringBuilder(replace.substring(0, replace.length() - 2));
replace.append("]");
} }
replace = new StringBuilder(replace.substring(0, replace.length() - 2));
replace.append("]");
} else { } else {
replace.append(entry.getValue()); replace.append(entry.getValue());
} }