Ensure that onDisconnect() is called on duplicate login

This commit is contained in:
kuroppoi 2022-04-10 17:22:05 +02:00
parent 6ce3df4d9b
commit 07c46f2050

View file

@ -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() {