From 7d57be96c686b489f1b7a1c2d21450dbe9f35403 Mon Sep 17 00:00:00 2001 From: rolleander Date: Tue, 17 Oct 2023 20:53:26 +0200 Subject: [PATCH] update --- src/main/java/com/broll/networklib/server/GameServer.java | 6 ++++-- .../java/com/broll/networklib/server/NetworkConnection.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/broll/networklib/server/GameServer.java b/src/main/java/com/broll/networklib/server/GameServer.java index 226fef9..d74413f 100644 --- a/src/main/java/com/broll/networklib/server/GameServer.java +++ b/src/main/java/com/broll/networklib/server/GameServer.java @@ -104,8 +104,10 @@ public void connected(Connection c) { public void disconnected(Connection c) { Log.info(c + " disconnected from server"); NetworkConnection connection = (NetworkConnection) c; - connection.setActive(false); - passAllSites(connection, sites -> sites.forEach(site -> site.onDisconnect(connection))); + if(connection.isActive()){ + connection.setActive(false); + passAllSites(connection, sites -> sites.forEach(site -> site.onDisconnect(connection))); + } discardConnection(connection); } diff --git a/src/main/java/com/broll/networklib/server/NetworkConnection.java b/src/main/java/com/broll/networklib/server/NetworkConnection.java index 9ed1d2d..37fb85f 100644 --- a/src/main/java/com/broll/networklib/server/NetworkConnection.java +++ b/src/main/java/com/broll/networklib/server/NetworkConnection.java @@ -9,7 +9,7 @@ public class NetworkConnection extends Connection { private Player player; - private boolean active = true; + private boolean active = false; public void setPlayer(Player player) { this.player = player;