mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-09 23:37:51 +07:00
Fixed ghost connections
This commit is contained in:
@ -79,7 +79,9 @@ public class NetServer extends Module{
|
|||||||
|
|
||||||
public NetServer(){
|
public NetServer(){
|
||||||
Events.on(WorldLoadEvent.class, event -> {
|
Events.on(WorldLoadEvent.class, event -> {
|
||||||
|
if(!headless){
|
||||||
connections.clear();
|
connections.clear();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Net.handleServer(Connect.class, (id, connect) -> {
|
Net.handleServer(Connect.class, (id, connect) -> {
|
||||||
@ -596,6 +598,12 @@ public class NetServer extends Module{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void sync(){
|
void sync(){
|
||||||
|
for(Player player : playerGroup.all()){
|
||||||
|
if(player.con == null || connections.get(player.con.id) == null){
|
||||||
|
onDisconnect(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
//iterate through each player
|
//iterate through each player
|
||||||
|
@ -71,7 +71,6 @@ public class KryoServer implements ServerProvider {
|
|||||||
@Override
|
@Override
|
||||||
public void disconnected (Connection connection) {
|
public void disconnected (Connection connection) {
|
||||||
KryoConnection k = getByKryoID(connection.getID());
|
KryoConnection k = getByKryoID(connection.getID());
|
||||||
Log.info("&bLost kryonet connection {0}", connection.getID());
|
|
||||||
if(k == null) return;
|
if(k == null) return;
|
||||||
|
|
||||||
Disconnect c = new Disconnect();
|
Disconnect c = new Disconnect();
|
||||||
|
Reference in New Issue
Block a user