From 07c46f2050e31fcb6991a18a974f4845084b8596 Mon Sep 17 00:00:00 2001 From: kuroppoi <68156848+kuroppoi@users.noreply.github.com> Date: Sun, 10 Apr 2022 17:22:05 +0200 Subject: [PATCH] Ensure that onDisconnect() is called on duplicate login --- .../java/brainwine/gameserver/entity/player/Player.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gameserver/src/main/java/brainwine/gameserver/entity/player/Player.java b/gameserver/src/main/java/brainwine/gameserver/entity/player/Player.java index fc123c3..7368dc4 100644 --- a/gameserver/src/main/java/brainwine/gameserver/entity/player/Player.java +++ b/gameserver/src/main/java/brainwine/gameserver/entity/player/Player.java @@ -263,6 +263,7 @@ public class Player extends Entity implements CommandExecutor { } dialogs.clear(); + connection.setPlayer(null); connection = null; } @@ -710,10 +711,14 @@ public class Player extends Entity implements CommandExecutor { public void setConnection(Connection connection) { if(isOnline()) { kick("You logged in from another location."); + onDisconnect(); + } + + if(connection != null) { + connection.setPlayer(this); } this.connection = connection; - connection.setPlayer(this); } public boolean isOnline() {