Adding debug mode to config

This commit is contained in:
samo_lego 2020-09-12 17:34:56 +02:00
parent e0d0a062f6
commit 7def6aea23
2 changed files with 11 additions and 1 deletions

View File

@ -180,6 +180,10 @@ public class AuthConfig {
* Allows attacking mobs. * Allows attacking mobs.
*/ */
public boolean allowEntityPunch = false; 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). * Whether to use BCrypt instead of Argon2 (GLIBC_2.25 error).
* @see <a href="https://github.com/samolego/SimpleAuth/wiki/GLIBC-problems" target="_blank">wiki</a> * @see <a href="https://github.com/samolego/SimpleAuth/wiki/GLIBC-problems" target="_blank">wiki</a>

View File

@ -7,6 +7,7 @@ import net.minecraft.text.LiteralText;
import static org.samo_lego.simpleauth.SimpleAuth.DB; import static org.samo_lego.simpleauth.SimpleAuth.DB;
import static org.samo_lego.simpleauth.SimpleAuth.config; 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 * Class used for storing the non-authenticated player's cache
@ -61,6 +62,8 @@ public class PlayerCache {
return; return;
if(player != null) { if(player != null) {
if(config.experimental.debugMode)
logInfo("Creating cache for " + player.getName());
this.lastIp = player.getIp(); this.lastIp = player.getIp();
this.lastAir = player.getAir(); this.lastAir = player.getAir();
@ -89,7 +92,8 @@ public class PlayerCache {
player.sendMessage(new LiteralText(config.lang.corruptedPlayerData), false); 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.password = "";
this.isRegistered = false; this.isRegistered = false;
} }
@ -126,5 +130,7 @@ public class PlayerCache {
} }
this.isAuthenticated = false; this.isAuthenticated = false;
this.loginTries = 0; this.loginTries = 0;
if(config.experimental.debugMode)
logInfo("Cache created. Registered: " + this.isRegistered + ", hashed password: " + this.password);
} }
} }