Fixed ghost connections

This commit is contained in:
Anuken
2018-11-29 09:32:36 -05:00
parent e40e5e6a99
commit f474d2c834
2 changed files with 9 additions and 2 deletions

View File

@ -79,7 +79,9 @@ public class NetServer extends Module{
public NetServer(){
Events.on(WorldLoadEvent.class, event -> {
connections.clear();
if(!headless){
connections.clear();
}
});
Net.handleServer(Connect.class, (id, connect) -> {
@ -596,6 +598,12 @@ public class NetServer extends Module{
}
void sync(){
for(Player player : playerGroup.all()){
if(player.con == null || connections.get(player.con.id) == null){
onDisconnect(player);
}
}
try{
//iterate through each player

View File

@ -71,7 +71,6 @@ public class KryoServer implements ServerProvider {
@Override
public void disconnected (Connection connection) {
KryoConnection k = getByKryoID(connection.getID());
Log.info("&bLost kryonet connection {0}", connection.getID());
if(k == null) return;
Disconnect c = new Disconnect();