Crash fixes

This commit is contained in:
samo_lego 2020-05-06 08:44:28 +02:00
parent 12ceb906df
commit 6d507bdc7b
3 changed files with 15 additions and 13 deletions

View File

@ -3,11 +3,11 @@ org.gradle.jvmargs=-Xmx1G
# Fabric properties # Fabric properties
minecraft_version=20w18a minecraft_version=20w18a
yarn_mappings=20w18a+build.1 yarn_mappings=20w18a+build.15
loader_version=0.8.2+build.194 loader_version=0.8.2+build.194
#Fabric api #Fabric api
fabric_version=0.7.0+build.330-1.16 fabric_version=0.10.4+build.340-1.16
# Mod Properties # Mod Properties
mod_version = 1.4.1 mod_version = 1.4.1

View File

@ -79,15 +79,17 @@ public class AuthEventHandler {
// Checking if session is still valid // Checking if session is still valid
String uuid = convertUuid(player); String uuid = convertUuid(player);
PlayerCache playerCache = deauthenticatedUsers.getOrDefault(uuid, null); PlayerCache playerCache = deauthenticatedUsers.getOrDefault(uuid, null);
if ( if(playerCache != null) {
playerCache != null && if (
playerCache.wasAuthenticated && playerCache.wasAuthenticated &&
playerCache.validUntil >= System.currentTimeMillis() && playerCache.validUntil >= System.currentTimeMillis() &&
playerCache.lastIp.equals(player.getIp()) playerCache.lastIp.equals(player.getIp())
) { ) {
deauthenticatedUsers.remove(uuid); // Makes player authenticated deauthenticatedUsers.remove(uuid); // Makes player authenticated
return; return;
}
// Session is invalid
} }
else else
deauthenticatePlayer(player); deauthenticatePlayer(player);

View File

@ -11,7 +11,7 @@ import static org.samo_lego.simpleauth.SimpleAuth.serverProp;
*/ */
public class UuidConverter { 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. /** Gets player UUID.
* *
@ -25,7 +25,7 @@ public class UuidConverter {
/* Lower case is used for Player and PlAyEr to get same UUID /* Lower case is used for Player and PlAyEr to get same UUID
Mimicking Mojang behaviour, where players cannot set their name to 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(); String playername = player.getName().asString().toLowerCase();
return PlayerEntity.getOfflinePlayerUuid(playername).toString(); return PlayerEntity.getOfflinePlayerUuid(playername).toString();
} }