Update RegionHandler.java (#2295)

Who decided to regex it like that???
This commit is contained in:
Ceris White 2023-08-20 13:47:08 -05:00 committed by GitHub
parent b8fd2e2378
commit 2b0f2f74cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -176,13 +176,13 @@ public final class RegionHandler implements Router {
Logger logger = Grasscutter.getLogger(); Logger logger = Grasscutter.getLogger();
if (ctx.queryParamMap().containsKey("version") && ctx.queryParamMap().containsKey("platform")) { if (ctx.queryParamMap().containsKey("version") && ctx.queryParamMap().containsKey("platform")) {
String versionName = ctx.queryParam("version"); String versionName = ctx.queryParam("version");
String versionCode = versionName.replaceAll("[/.0-9]*", ""); String versionCode = versionName.substring(0,8);
String platformName = ctx.queryParam("platform"); String platformName = ctx.queryParam("platform");
// Determine the region list to use based on the version and platform. // Determine the region list to use based on the version and platform.
if ("CNRELiOS".equals(versionCode) if ("CNRELiOS".equals(versionCode)
|| "CNRELWin".equals(versionCode) || "CNRELWin".equals(versionCode)
|| "CNRELAndroid".equals(versionCode)) { || "CNRELAnd".equals(versionCode)) {
// Use the CN region list. // Use the CN region list.
QueryAllRegionsEvent event = new QueryAllRegionsEvent(regionListResponseCN); QueryAllRegionsEvent event = new QueryAllRegionsEvent(regionListResponseCN);
event.call(); event.call();
@ -191,7 +191,7 @@ public final class RegionHandler implements Router {
ctx.result(event.getRegionList()); ctx.result(event.getRegionList());
} else if ("OSRELiOS".equals(versionCode) } else if ("OSRELiOS".equals(versionCode)
|| "OSRELWin".equals(versionCode) || "OSRELWin".equals(versionCode)
|| "OSRELAndroid".equals(versionCode)) { || "OSRELAnd".equals(versionCode)) {
// Use the OS region list. // Use the OS region list.
QueryAllRegionsEvent event = new QueryAllRegionsEvent(regionListResponse); QueryAllRegionsEvent event = new QueryAllRegionsEvent(regionListResponse);
event.call(); event.call();