mirror of
https://github.com/array-in-a-matrix/brainwine.git
synced 2025-04-02 11:11:58 -04:00
Ensure that onDisconnect() is called on duplicate login
This commit is contained in:
parent
6ce3df4d9b
commit
07c46f2050
1 changed files with 6 additions and 1 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Reference in a new issue