From 6949711e09ae7a6e08ee186488a10254165ed1ba Mon Sep 17 00:00:00 2001 From: Benj Date: Tue, 23 Aug 2022 22:15:30 +0800 Subject: [PATCH] Actually fix RegionHandler --- .../grasscutter/server/http/dispatch/RegionHandler.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/emu/grasscutter/server/http/dispatch/RegionHandler.java b/src/main/java/emu/grasscutter/server/http/dispatch/RegionHandler.java index ef5336a9d..40a2c2037 100644 --- a/src/main/java/emu/grasscutter/server/http/dispatch/RegionHandler.java +++ b/src/main/java/emu/grasscutter/server/http/dispatch/RegionHandler.java @@ -28,6 +28,7 @@ import java.security.spec.X509EncodedKeySpec; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.security.Signature; +import java.util.regex.Pattern; import static emu.grasscutter.config.Configuration.*; import static emu.grasscutter.net.proto.QueryRegionListHttpRspOuterClass.QueryRegionListHttpRsp; @@ -140,9 +141,10 @@ public final class RegionHandler implements Router { regionData = region.getBase64(); } - int versionMajor = Integer.parseInt(versionName.split(".")[0]); - int versionMinor = Integer.parseInt(versionName.split(".")[1]); - int versionFix = Integer.parseInt(versionName.split(".")[2]); + String[] versionCode = versionName.replaceAll(Pattern.compile("[a-zA-Z]").pattern(), "").split("\\."); + int versionMajor = Integer.parseInt(versionCode[0]); + int versionMinor = Integer.parseInt(versionCode[1]); + int versionFix = Integer.parseInt(versionCode[2]); if (versionMajor >= 3 || (versionMajor == 2 && versionMinor == 7 && versionFix >= 50) || (versionMajor == 2 && versionMinor == 8)) { try {