From 43fe6be13e9a610a3e9324d5dc8ea1b881a93300 Mon Sep 17 00:00:00 2001 From: Richard Wardin Date: Fri, 15 Nov 2019 19:37:26 -0500 Subject: [PATCH] Display the server status on gameover (map, players, wave, etc) (#1068) --- .../anuke/mindustry/server/ServerControl.java | 51 ++++++++++--------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/server/src/io/anuke/mindustry/server/ServerControl.java b/server/src/io/anuke/mindustry/server/ServerControl.java index 7297a3c138..fc9014a987 100644 --- a/server/src/io/anuke/mindustry/server/ServerControl.java +++ b/server/src/io/anuke/mindustry/server/ServerControl.java @@ -142,6 +142,7 @@ public class ServerControl implements ApplicationListener{ Events.on(GameOverEvent.class, event -> { if(inExtraRound) return; info("Game over!"); + displayStatus(); if(Core.settings.getBool("shuffle")){ if(maps.all().size > 0){ @@ -299,29 +300,7 @@ public class ServerControl implements ApplicationListener{ }); handler.register("status", "Display server status.", arg -> { - if(state.is(State.menu)){ - info("Status: &rserver closed"); - }else{ - info("Status:"); - info(" &lyPlaying on map &fi{0}&fb &lb/&ly Wave {1}", Strings.capitalize(world.getMap().name()), state.wave); - - if(state.rules.waves){ - info("&ly {0} enemies.", unitGroups[Team.crux.ordinal()].size()); - }else{ - info("&ly {0} seconds until next wave.", (int)(state.wavetime / 60)); - } - - info(" &ly{0} FPS, {1} MB used.", (int)(60f / Time.delta()), Core.app.getJavaHeap() / 1024 / 1024); - - if(playerGroup.size() > 0){ - info(" &lyPlayers: {0}", playerGroup.size()); - for(Player p : playerGroup.all()){ - info(" &y{0} / {1}", p.name, p.uuid); - } - }else{ - info(" &lyNo players connected."); - } - } + displayStatus(); }); handler.register("mods", "Display all loaded mods.", arg -> { @@ -765,6 +744,32 @@ public class ServerControl implements ApplicationListener{ mods.each(p -> p.registerClientCommands(netServer.clientCommands)); } + private void displayStatus() { + if(state.is(State.menu)){ + info("Status: &rserver closed"); + }else{ + info("Status:"); + info(" &lyPlaying on map &fi{0}&fb &lb/&ly Wave {1}", Strings.capitalize(world.getMap().name()), state.wave); + + if(state.rules.waves){ + info("&ly {0} enemies.", unitGroups[Team.crux.ordinal()].size()); + }else{ + info("&ly {0} seconds until next wave.", (int)(state.wavetime / 60)); + } + + info(" &ly{0} FPS, {1} MB used.", (int)(60f / Time.delta()), Core.app.getJavaHeap() / 1024 / 1024); + + if(playerGroup.size() > 0){ + info(" &lyPlayers: {0}", playerGroup.size()); + for(Player p : playerGroup.all()){ + info(" &y{0} / {1}", p.name, p.uuid); + } + }else{ + info(" &lyNo players connected."); + } + } + } + private void readCommands(){ Scanner scan = new Scanner(System.in);