From 30341e2a6d5a0b67fec76c62e832a4667b84736b Mon Sep 17 00:00:00 2001 From: Petr Ilin Date: Mon, 6 Feb 2023 21:39:28 +0300 Subject: 1.1.11 release: status-code-* options are now lists --- VERSION | 2 +- build.gradle | 2 +- src/main/java/net/elytrium/limboauth/LimboAuth.java | 6 +++--- src/main/java/net/elytrium/limboauth/Settings.java | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/VERSION b/VERSION index 5ed5faa..9ee1f78 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.10 +1.1.11 diff --git a/build.gradle b/build.gradle index 3e82328..f2cb645 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ plugins { } setGroup("net.elytrium") -setVersion("1.1.10") +setVersion("1.1.11") java { setSourceCompatibility(JavaVersion.VERSION_11) diff --git a/src/main/java/net/elytrium/limboauth/LimboAuth.java b/src/main/java/net/elytrium/limboauth/LimboAuth.java index de03a22..76b89f8 100644 --- a/src/main/java/net/elytrium/limboauth/LimboAuth.java +++ b/src/main/java/net/elytrium/limboauth/LimboAuth.java @@ -682,18 +682,18 @@ public class LimboAuth { int statusCode = response.statusCode(); - if (statusCode == Settings.IMP.MAIN.STATUS_CODE_RATE_LIMIT) { + if (Settings.IMP.MAIN.STATUS_CODE_RATE_LIMIT.contains(statusCode)) { return new PremiumResponse(PremiumState.RATE_LIMIT); } JsonElement jsonElement = JsonParser.parseString(response.body()); - if (statusCode == Settings.IMP.MAIN.STATUS_CODE_USER_EXISTS + if (Settings.IMP.MAIN.STATUS_CODE_USER_EXISTS.contains(statusCode) && this.validateScheme(jsonElement, Settings.IMP.MAIN.USER_EXISTS_JSON_VALIDATOR_FIELDS)) { return new PremiumResponse(PremiumState.PREMIUM_USERNAME, ((JsonObject) jsonElement).get(Settings.IMP.MAIN.JSON_UUID_FIELD).getAsString()); } - if (statusCode == Settings.IMP.MAIN.STATUS_CODE_USER_NOT_EXISTS + if (Settings.IMP.MAIN.STATUS_CODE_USER_NOT_EXISTS.contains(statusCode) && this.validateScheme(jsonElement, Settings.IMP.MAIN.USER_NOT_EXISTS_JSON_VALIDATOR_FIELDS)) { return new PremiumResponse(PremiumState.CRACKED); } diff --git a/src/main/java/net/elytrium/limboauth/Settings.java b/src/main/java/net/elytrium/limboauth/Settings.java index e2b45c3..c2d7973 100644 --- a/src/main/java/net/elytrium/limboauth/Settings.java +++ b/src/main/java/net/elytrium/limboauth/Settings.java @@ -185,17 +185,17 @@ public class Settings extends YamlConfig { "Responses with unlisted status codes will be identified as responses with a server error", "Set 200 if you use using Mojang or CloudFlare API" }) - public int STATUS_CODE_USER_EXISTS = 200; - @Comment("Set 404 if you use Mojang or CloudFlare API") - public int STATUS_CODE_USER_NOT_EXISTS = 404; + public List STATUS_CODE_USER_EXISTS = List.of(200); + @Comment("Set 204 and 404 if you use Mojang API, 404 if you use CloudFlare API") + public List STATUS_CODE_USER_NOT_EXISTS = List.of(204, 404); @Comment("Set 429 if you use Mojang or CloudFlare API") - public int STATUS_CODE_RATE_LIMIT = 429; + public List STATUS_CODE_RATE_LIMIT = List.of(429); @Comment({ "Sample Mojang API exists response: {\"name\":\"hevav\",\"id\":\"9c7024b2a48746b3b3934f397ae5d70f\"}", "Sample CloudFlare API exists response: {\"uuid\":\"9c7024b2a48746b3b3934f397ae5d70f\",\"username\":\"hevav\", ...}", "", - "Sample Mojang API not exists response: {\"path\":\"/users/profiles/minecraft/someletters1234566\",\"errorMessage\":\"Couldn't find any profile with that name\"}", + "Sample Mojang API not exists response (sometimes can be empty): {\"path\":\"/users/profiles/minecraft/someletters1234566\",\"errorMessage\":\"Couldn't find any profile with that name\"}", "Sample CloudFlare API not exists response: {\"code\":404,\"error\":\"Not Found\",\"reason\":\"No user with the name 'someletters123456' was found\"}", "", "Responses with an invalid scheme will be identified as responses with a server error", -- cgit