From 7def6aea23f73e3a3c6cc70d947fd34dc6177acf Mon Sep 17 00:00:00 2001 From: samo_lego <34912839+samolego@users.noreply.github.com> Date: Sat, 12 Sep 2020 17:34:56 +0200 Subject: [PATCH] Adding debug mode to config --- .../java/org/samo_lego/simpleauth/storage/AuthConfig.java | 4 ++++ .../org/samo_lego/simpleauth/storage/PlayerCache.java | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/samo_lego/simpleauth/storage/AuthConfig.java b/src/main/java/org/samo_lego/simpleauth/storage/AuthConfig.java index 6a419f6..dfa379c 100644 --- a/src/main/java/org/samo_lego/simpleauth/storage/AuthConfig.java +++ b/src/main/java/org/samo_lego/simpleauth/storage/AuthConfig.java @@ -180,6 +180,10 @@ public class AuthConfig { * Allows attacking mobs. */ public boolean allowEntityPunch = false; + /** + * Debug mode. Expect much spam in console. + */ + public boolean debugMode = false; /** * Whether to use BCrypt instead of Argon2 (GLIBC_2.25 error). * @see wiki diff --git a/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java b/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java index b16d31d..426bbf2 100644 --- a/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java +++ b/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java @@ -7,6 +7,7 @@ import net.minecraft.text.LiteralText; import static org.samo_lego.simpleauth.SimpleAuth.DB; import static org.samo_lego.simpleauth.SimpleAuth.config; +import static org.samo_lego.simpleauth.utils.SimpleLogger.logInfo; /** * Class used for storing the non-authenticated player's cache @@ -61,6 +62,8 @@ public class PlayerCache { return; if(player != null) { + if(config.experimental.debugMode) + logInfo("Creating cache for " + player.getName()); this.lastIp = player.getIp(); this.lastAir = player.getAir(); @@ -89,7 +92,8 @@ public class PlayerCache { player.sendMessage(new LiteralText(config.lang.corruptedPlayerData), false); } - // This shouldn't have happened, data seems to be corrupted + if(config.experimental.debugMode) + logInfo("Password for " + uuid + " is null! Marking as not registered."); this.password = ""; this.isRegistered = false; } @@ -126,5 +130,7 @@ public class PlayerCache { } this.isAuthenticated = false; this.loginTries = 0; + if(config.experimental.debugMode) + logInfo("Cache created. Registered: " + this.isRegistered + ", hashed password: " + this.password); } }