diff options
author | Petr Ilin <hevav@hevav.dev> | 2023-02-06 21:39:28 +0300 |
---|---|---|
committer | Petr Ilin <hevav@hevav.dev> | 2023-02-06 21:39:28 +0300 |
commit | 30341e2a6d5a0b67fec76c62e832a4667b84736b (patch) | |
tree | 268ea54fa0e657972f23c40c697c3bb015858585 /src | |
parent | 6c002b74c63d1f2f7f4333b4c55bacd98e0f440d (diff) | |
download | LimboAuth-30341e2a6d5a0b67fec76c62e832a4667b84736b.tar.gz LimboAuth-30341e2a6d5a0b67fec76c62e832a4667b84736b.tar.bz2 LimboAuth-30341e2a6d5a0b67fec76c62e832a4667b84736b.zip |
1.1.11 release: status-code-* options are now lists
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/net/elytrium/limboauth/LimboAuth.java | 6 | ||||
-rw-r--r-- | src/main/java/net/elytrium/limboauth/Settings.java | 10 |
2 files changed, 8 insertions, 8 deletions
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<Integer> 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<Integer> 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<Integer> 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", |