Skip to content

Commit

Permalink
1.1.11 release: status-code-* options are now lists
Browse files Browse the repository at this point in the history
  • Loading branch information
hevav committed Feb 6, 2023
1 parent 6c002b7 commit 30341e2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.10
1.1.11
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

setGroup("net.elytrium")
setVersion("1.1.10")
setVersion("1.1.11")

java {
setSourceCompatibility(JavaVersion.VERSION_11)
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/elytrium/limboauth/LimboAuth.java
Original file line number Diff line number Diff line change
Expand Up @@ -682,18 +682,18 @@ public PremiumResponse isPremiumExternal(String nickname) {

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);
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/net/elytrium/limboauth/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,17 @@ public static class MAIN {
"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",
Expand Down

0 comments on commit 30341e2

Please sign in to comment.