diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 73e2938c5c..7b4b8ca9d2 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -17,6 +17,7 @@ text.name=Name: text.public=Public text.players={0} players online text.players.single={0} player online +text.server.closing=[accent]Closing server... text.server.kicked.kick=You have been kicked from the server! text.server.kicked.invalidPassword=Invalid password! text.server.connected={0} has joined. diff --git a/core/src/io/anuke/mindustry/core/NetServer.java b/core/src/io/anuke/mindustry/core/NetServer.java index a70814bf01..6e27351e29 100644 --- a/core/src/io/anuke/mindustry/core/NetServer.java +++ b/core/src/io/anuke/mindustry/core/NetServer.java @@ -34,6 +34,7 @@ public class NetServer extends Module{ /**Maps connection IDs to players.*/ IntMap connections = new IntMap<>(); float serverSyncTime = 4, itemSyncTime = 10, blockSyncTime = 120; + boolean closing = false; public NetServer(){ @@ -225,8 +226,14 @@ public class NetServer extends Module{ if(!GameState.is(State.menu) && Net.active()){ sync(); - }else{ - Net.closeServer(); + }else if(!closing){ + closing = true; + Vars.ui.loadfrag.show("$text.server.closing"); + Timers.runTask(5f, () -> { + Net.closeServer(); + Vars.ui.loadfrag.hide(); + closing = false; + }); } }