From 4db0578cf7ad55f8dbe506eaa7874ddbae75e2cc Mon Sep 17 00:00:00 2001 From: samo_lego <34912839+samolego@users.noreply.github.com> Date: Mon, 6 Jul 2020 10:40:32 +0200 Subject: [PATCH] Fixing handleDisconnection() #9 --- gradle.properties | 6 +++--- src/main/java/org/samo_lego/simpleauth/SimpleAuth.java | 2 +- .../org/samo_lego/simpleauth/event/AuthEventHandler.java | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3fb3ead..e9f1289 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,11 +3,11 @@ org.gradle.jvmargs=-Xmx1G # Fabric properties minecraft_version=1.16.1 -yarn_mappings=1.16.1+build.17 -loader_version=0.8.8+build.202 +yarn_mappings=1.16.1+build.20 +loader_version=0.8.9+build.203 #Fabric api -fabric_version=0.14.0+build.371-1.16 +fabric_version=0.14.1+build.372-1.16 # Mod Properties mod_version = 1.4.6 diff --git a/src/main/java/org/samo_lego/simpleauth/SimpleAuth.java b/src/main/java/org/samo_lego/simpleauth/SimpleAuth.java index a3742c9..4a6cee5 100644 --- a/src/main/java/org/samo_lego/simpleauth/SimpleAuth.java +++ b/src/main/java/org/samo_lego/simpleauth/SimpleAuth.java @@ -206,7 +206,7 @@ public class SimpleAuth implements DedicatedServerModInitializer { timer.schedule(new TimerTask() { @Override public void run() { - if(!SimpleAuth.isAuthenticated(player)) // Kicking player if not authenticated + if(!SimpleAuth.isAuthenticated(player) && player.networkHandler.getConnection().isOpen()) // Kicking player if not authenticated player.networkHandler.disconnect(new LiteralText(SimpleAuth.config.lang.timeExpired)); } }, SimpleAuth.config.main.delay * 1000); 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 9b0c101..20d12db 100644 --- a/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java +++ b/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java @@ -35,8 +35,6 @@ public class AuthEventHandler { return new LiteralText(config.lang.notAuthenticated); } - private static Text successfulPortalRescue = new LiteralText(config.lang.successfulPortalRescue); - // Player pre-join // Returns text as a reason for disconnect or null to pass public static LiteralText checkCanPlayerJoinServer(SocketAddress socketAddress, GameProfile profile, PlayerManager manager) {