aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/net/elytrium/limboauth/LimboAuth.java33
-rw-r--r--src/main/java/net/elytrium/limboauth/command/PremiumCommand.java2
2 files changed, 20 insertions, 15 deletions
diff --git a/src/main/java/net/elytrium/limboauth/LimboAuth.java b/src/main/java/net/elytrium/limboauth/LimboAuth.java
index dd4bdd8..215e9c8 100644
--- a/src/main/java/net/elytrium/limboauth/LimboAuth.java
+++ b/src/main/java/net/elytrium/limboauth/LimboAuth.java
@@ -681,7 +681,7 @@ public class LimboAuth {
if (statusCode == Settings.IMP.MAIN.STATUS_CODE_USER_EXISTS
&& this.validateScheme(jsonElement, Settings.IMP.MAIN.USER_EXISTS_JSON_VALIDATOR_FIELDS)) {
- return new PremiumResponse(PremiumState.PREMIUM, ((JsonObject) jsonElement).get(Settings.IMP.MAIN.JSON_UUID_FIELD).getAsString());
+ 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
@@ -768,6 +768,10 @@ public class LimboAuth {
return false;
}
case PREMIUM: {
+ this.premiumCache.put(lowercaseNickname, new CachedPremiumUser(System.currentTimeMillis(), true));
+ return true;
+ }
+ case PREMIUM_USERNAME: {
premium = true;
break;
}
@@ -787,14 +791,6 @@ public class LimboAuth {
}
}
- if (wasRateLimited && unknown || wasRateLimited && wasError) {
- return Settings.IMP.MAIN.ON_RATE_LIMIT_PREMIUM;
- }
-
- if (wasError && unknown || !premium) {
- return Settings.IMP.MAIN.ON_SERVER_ERROR_PREMIUM;
- }
-
if (unknown) {
if (uuid != null && this.isPremiumUuid(uuid)) {
this.premiumCache.put(lowercaseNickname, new CachedPremiumUser(System.currentTimeMillis(), true));
@@ -806,6 +802,14 @@ public class LimboAuth {
}
}
+ if (wasRateLimited && unknown || wasRateLimited && wasError) {
+ return Settings.IMP.MAIN.ON_RATE_LIMIT_PREMIUM;
+ }
+
+ if (wasError && unknown || !premium) {
+ return Settings.IMP.MAIN.ON_SERVER_ERROR_PREMIUM;
+ }
+
this.premiumCache.put(lowercaseNickname, new CachedPremiumUser(System.currentTimeMillis(), true));
return true;
}
@@ -984,10 +988,11 @@ public class LimboAuth {
}
public enum PremiumState {
- PREMIUM(),
- CRACKED(),
- UNKNOWN(),
- RATE_LIMIT(),
- ERROR()
+ PREMIUM,
+ PREMIUM_USERNAME,
+ CRACKED,
+ UNKNOWN,
+ RATE_LIMIT,
+ ERROR
}
}
diff --git a/src/main/java/net/elytrium/limboauth/command/PremiumCommand.java b/src/main/java/net/elytrium/limboauth/command/PremiumCommand.java
index f4063d7..53cce89 100644
--- a/src/main/java/net/elytrium/limboauth/command/PremiumCommand.java
+++ b/src/main/java/net/elytrium/limboauth/command/PremiumCommand.java
@@ -77,7 +77,7 @@ public class PremiumCommand implements SimpleCommand {
} else if (player.getHash().isEmpty()) {
source.sendMessage(this.alreadyPremium);
} else if (AuthSessionHandler.checkPassword(args[0], player, this.playerDao)) {
- if (this.plugin.isPremiumExternal(username.toLowerCase(Locale.ROOT)).getState() == LimboAuth.PremiumState.PREMIUM) {
+ if (this.plugin.isPremiumExternal(username.toLowerCase(Locale.ROOT)).getState() == LimboAuth.PremiumState.PREMIUM_USERNAME) {
try {
player.setHash("");
this.playerDao.update(player);