From 1b0985710c66a56c07d38e3c2fe75e5dbaaf102b Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Fri, 6 May 2022 09:00:46 -0400 Subject: [PATCH] special characters in lists fix, empty list fix --- .../hideAndSeek/configuration/ConfigManager.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java index c844924..4bb1a83 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java @@ -247,13 +247,16 @@ public class ConfigManager { if(end == -1) end = yamlString.length(); StringBuilder replace = new StringBuilder(new String("".getBytes(), StandardCharsets.UTF_8)); if(entry.getValue() instanceof List){ - if(((List) entry.getValue()).isEmpty()) continue; - replace.append("["); - for(Object o : (List)entry.getValue()){ - replace.append(new String(o.toString().getBytes(), StandardCharsets.UTF_8)).append(", "); + if(((List) entry.getValue()).isEmpty()){ + replace.append("[]"); + } else { + 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 { replace.append(entry.getValue()); }