diff --git a/src/main/java/io/github/gaming32/worldhost/WorldHost.java b/src/main/java/io/github/gaming32/worldhost/WorldHost.java index ad31924..b812723 100644 --- a/src/main/java/io/github/gaming32/worldhost/WorldHost.java +++ b/src/main/java/io/github/gaming32/worldhost/WorldHost.java @@ -295,6 +295,7 @@ private static void init(IOFunction assetGetter, Path modPath) { "world-host.nonstandard_origin.desc", nonstandardOrigins.stream() .map(URI::getHost) + .distinct() .collect(Collectors.joining(", ")) )) .important() diff --git a/src/main/java/io/github/gaming32/worldhost/origincheck/checker/WindowsOriginChecker.java b/src/main/java/io/github/gaming32/worldhost/origincheck/checker/WindowsOriginChecker.java index 992cd47..123daa8 100644 --- a/src/main/java/io/github/gaming32/worldhost/origincheck/checker/WindowsOriginChecker.java +++ b/src/main/java/io/github/gaming32/worldhost/origincheck/checker/WindowsOriginChecker.java @@ -4,8 +4,9 @@ import org.jetbrains.annotations.Nullable; import java.io.BufferedReader; -import java.io.CharArrayReader; +import java.io.ByteArrayInputStream; import java.io.IOException; +import java.io.InputStreamReader; import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.util.Arrays; @@ -34,8 +35,12 @@ String getOriginAttributeName() { } private static Map> parseZoneIdentifier(ByteBuffer bb) throws IOException { - final var cb = getWindowsCharset().decode(bb); - try (var reader = new BufferedReader(new CharArrayReader(cb.array(), cb.arrayOffset() + cb.position(), cb.remaining()))) { + try (var reader = new BufferedReader( + new InputStreamReader( + new ByteArrayInputStream(bb.array(), bb.arrayOffset() + bb.position(), bb.remaining()), + getWindowsCharset() + ) + )) { return SimpleIniParser.parse(reader); } } diff --git a/src/main/java/io/github/gaming32/worldhost/origincheck/parser/SimpleIniParser.java b/src/main/java/io/github/gaming32/worldhost/origincheck/parser/SimpleIniParser.java index 19e7ee2..71c4ff6 100644 --- a/src/main/java/io/github/gaming32/worldhost/origincheck/parser/SimpleIniParser.java +++ b/src/main/java/io/github/gaming32/worldhost/origincheck/parser/SimpleIniParser.java @@ -25,6 +25,9 @@ public static Map> parse(BufferedReader reader) thro section.put(split[0].trim(), split[1].trim()); } + if (result.get("").isEmpty()) { + result.remove(""); + } return result; } }