diff --git a/gradle.properties b/gradle.properties index 45ccedf..aa996ff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,11 +3,11 @@ org.gradle.jvmargs=-Xmx1G # Fabric properties minecraft_version=20w18a -yarn_mappings=20w18a+build.1 +yarn_mappings=20w18a+build.15 loader_version=0.8.2+build.194 #Fabric api -fabric_version=0.7.0+build.330-1.16 +fabric_version=0.10.4+build.340-1.16 # Mod Properties mod_version = 1.4.1 diff --git a/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java b/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java index ccd1a46..f61fc0b 100644 --- a/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java +++ b/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java @@ -79,15 +79,17 @@ public class AuthEventHandler { // Checking if session is still valid String uuid = convertUuid(player); PlayerCache playerCache = deauthenticatedUsers.getOrDefault(uuid, null); - - if ( - playerCache != null && - playerCache.wasAuthenticated && - playerCache.validUntil >= System.currentTimeMillis() && - playerCache.lastIp.equals(player.getIp()) - ) { - deauthenticatedUsers.remove(uuid); // Makes player authenticated - return; + + if(playerCache != null) { + if ( + playerCache.wasAuthenticated && + playerCache.validUntil >= System.currentTimeMillis() && + playerCache.lastIp.equals(player.getIp()) + ) { + deauthenticatedUsers.remove(uuid); // Makes player authenticated + return; + } + // Session is invalid } else deauthenticatePlayer(player); diff --git a/src/main/java/org/samo_lego/simpleauth/utils/UuidConverter.java b/src/main/java/org/samo_lego/simpleauth/utils/UuidConverter.java index 967afbf..0bec1bc 100644 --- a/src/main/java/org/samo_lego/simpleauth/utils/UuidConverter.java +++ b/src/main/java/org/samo_lego/simpleauth/utils/UuidConverter.java @@ -11,7 +11,7 @@ import static org.samo_lego.simpleauth.SimpleAuth.serverProp; */ public class UuidConverter { - private static final boolean isOnline = (boolean) serverProp.getOrDefault("online-mode", false); + private static final boolean isOnline = Boolean.parseBoolean(serverProp.getProperty("online-mode")); /** Gets player UUID. * @@ -25,7 +25,7 @@ public class UuidConverter { /* Lower case is used for Player and PlAyEr to get same UUID Mimicking Mojang behaviour, where players cannot set their name to - ExAmple if example is already taken.*/ + ExAmple if Example is already taken.*/ String playername = player.getName().asString().toLowerCase(); return PlayerEntity.getOfflinePlayerUuid(playername).toString(); }