aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/elytrium/limboauth/Settings.java
diff options
context:
space:
mode:
authorPetr Ilin <hevav@hevav.dev>2022-12-07 03:00:52 +0300
committerPetr Ilin <hevav@hevav.dev>2022-12-07 03:00:52 +0300
commit6229032bfa9567cee72764ebf0edd8a2351385f4 (patch)
treea9808d8f1abdeba1ee583ed236cdfb085754b41c /src/main/java/net/elytrium/limboauth/Settings.java
parentc5301be88a029611d481db5b435fb07578e2e620 (diff)
downloadLimboAuth-6229032bfa9567cee72764ebf0edd8a2351385f4.tar.gz
LimboAuth-6229032bfa9567cee72764ebf0edd8a2351385f4.tar.bz2
LimboAuth-6229032bfa9567cee72764ebf0edd8a2351385f4.zip
Improved check of whether player is premium
Diffstat (limited to 'src/main/java/net/elytrium/limboauth/Settings.java')
-rw-r--r--src/main/java/net/elytrium/limboauth/Settings.java31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/main/java/net/elytrium/limboauth/Settings.java b/src/main/java/net/elytrium/limboauth/Settings.java
index 8a34d3b..99bb2f0 100644
--- a/src/main/java/net/elytrium/limboauth/Settings.java
+++ b/src/main/java/net/elytrium/limboauth/Settings.java
@@ -139,19 +139,46 @@ public class Settings extends YamlConfig {
@Comment({
"Custom isPremium URL",
"You can use Mojang one's API (set by default)",
- "Or CloudFlare one's: https://api.ashcon.app/mojang/v1/user/%s",
+ "Or CloudFlare one's: https://api.ashcon.app/mojang/v2/user/%s",
"Or use this code to make your own API: https://blog.cloudflare.com/minecraft-api-with-workers-coffeescript/",
- "Or implement your own API, it should just respond with HTTP code 200 only if the player is premium"
+ "Or implement your own API, it should just respond with HTTP code 200 (see parameters below) only if the player is premium"
})
public String ISPREMIUM_AUTH_URL = "https://api.mojang.com/users/profiles/minecraft/%s";
@Comment({
+ "Status codes (see the comment above)",
+ "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 204 if you use Mojang API, 404 if you use CloudFlare API")
+ public int STATUS_CODE_USER_NOT_EXISTS = 204;
+ @Comment("Set 429 if you use Mojang or CloudFlare API")
+ public int STATUS_CODE_RATE_LIMIT = 429;
+
+ @Comment({
+ "Sample Mojang API response: {\"name\":\"hevav\",\"id\":\"9c7024b2a48746b3b3934f397ae5d70f\"}",
+ "Sample CloudFlare API response: {\"uuid\":\"9c7024b2a48746b3b3934f397ae5d70f\",\"username\":\"hevav\", ...}",
+ "Responses with an invalid scheme will be identified as responses with a server error",
+ "Set this parameter to [], to disable JSON scheme validation"
+ })
+ public List<String> USER_EXISTS_JSON_VALIDATOR_FIELDS = List.of("name", "id");
+ public List<String> USER_NOT_EXISTS_JSON_VALIDATOR_FIELDS = List.of();
+
+ @Comment({
"If Mojang rate-limits your server, we cannot determine if the player is premium or not",
"This option allows you to choose whether every player will be defined as premium or as cracked while Mojang is rate-limiting the server",
"True - as premium; False - as cracked"
})
public boolean ON_RATE_LIMIT_PREMIUM = true;
+ @Comment({
+ "If Mojang API is down, we cannot determine if the player is premium or not",
+ "This option allows you to choose whether every player will be defined as premium or as cracked while Mojang API is unavailable",
+ "True - as premium; False - as cracked"
+ })
+ public boolean ON_SERVER_ERROR_PREMIUM = true;
+
public List<String> REGISTER_COMMAND = List.of("/r", "/reg", "/register");
public List<String> LOGIN_COMMAND = List.of("/l", "/log", "/login");
public List<String> TOTP_COMMAND = List.of("/2fa", "/totp");