Fixing handleDisconnection() #9

This commit is contained in:
samo_lego 2020-07-06 10:40:32 +02:00
parent f6b1ea8147
commit 4db0578cf7
3 changed files with 4 additions and 6 deletions

View File

@ -3,11 +3,11 @@ org.gradle.jvmargs=-Xmx1G
# Fabric properties # Fabric properties
minecraft_version=1.16.1 minecraft_version=1.16.1
yarn_mappings=1.16.1+build.17 yarn_mappings=1.16.1+build.20
loader_version=0.8.8+build.202 loader_version=0.8.9+build.203
#Fabric api #Fabric api
fabric_version=0.14.0+build.371-1.16 fabric_version=0.14.1+build.372-1.16
# Mod Properties # Mod Properties
mod_version = 1.4.6 mod_version = 1.4.6

View File

@ -206,7 +206,7 @@ public class SimpleAuth implements DedicatedServerModInitializer {
timer.schedule(new TimerTask() { timer.schedule(new TimerTask() {
@Override @Override
public void run() { 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)); player.networkHandler.disconnect(new LiteralText(SimpleAuth.config.lang.timeExpired));
} }
}, SimpleAuth.config.main.delay * 1000); }, SimpleAuth.config.main.delay * 1000);

View File

@ -35,8 +35,6 @@ public class AuthEventHandler {
return new LiteralText(config.lang.notAuthenticated); return new LiteralText(config.lang.notAuthenticated);
} }
private static Text successfulPortalRescue = new LiteralText(config.lang.successfulPortalRescue);
// Player pre-join // Player pre-join
// Returns text as a reason for disconnect or null to pass // Returns text as a reason for disconnect or null to pass
public static LiteralText checkCanPlayerJoinServer(SocketAddress socketAddress, GameProfile profile, PlayerManager manager) { public static LiteralText checkCanPlayerJoinServer(SocketAddress socketAddress, GameProfile profile, PlayerManager manager) {