From 2aee72b47ba9aebc2469d9917d24c67ee29577f0 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 8 Aug 2018 20:57:24 -0400 Subject: [PATCH] Improved host command --- .../src/io/anuke/mindustry/ai/Pathfinder.java | 3 -- .../anuke/mindustry/server/ServerControl.java | 43 +++++++++---------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/core/src/io/anuke/mindustry/ai/Pathfinder.java b/core/src/io/anuke/mindustry/ai/Pathfinder.java index 136930ed1b..528974078c 100644 --- a/core/src/io/anuke/mindustry/ai/Pathfinder.java +++ b/core/src/io/anuke/mindustry/ai/Pathfinder.java @@ -16,7 +16,6 @@ import io.anuke.mindustry.world.meta.BlockFlag; import io.anuke.ucore.core.Events; import io.anuke.ucore.core.Timers; import io.anuke.ucore.util.Geometry; -import io.anuke.ucore.util.Log; import static io.anuke.mindustry.Vars.state; import static io.anuke.mindustry.Vars.world; @@ -182,8 +181,6 @@ public class Pathfinder{ } state.spawner.checkAllQuadrants(); - - Log.info("Elapsed calculation time: {0}", Timers.elapsed()); } class PathData{ diff --git a/server/src/io/anuke/mindustry/server/ServerControl.java b/server/src/io/anuke/mindustry/server/ServerControl.java index 699fc09f91..6785389841 100644 --- a/server/src/io/anuke/mindustry/server/ServerControl.java +++ b/server/src/io/anuke/mindustry/server/ServerControl.java @@ -143,7 +143,7 @@ public class ServerControl extends Module{ Log.info("Stopped server."); }); - handler.register("host", "[mode] [mapname]", "Open the server with a specific map.", arg -> { + handler.register("host", "[mapname] [mode]", "Open the server with a specific map.", arg -> { if(state.is(State.playing)){ err("Already hosting. Type 'stop' to stop hosting first."); return; @@ -152,39 +152,38 @@ public class ServerControl extends Module{ Map result = null; if(arg.length > 0){ - GameMode mode; - try{ - mode = GameMode.valueOf(arg[0]); - }catch(IllegalArgumentException e){ - err("No gamemode '{0}' found.", arg[0]); + + String search = arg[0]; + for(Map map : world.maps().all()){ + if(map.name.equalsIgnoreCase(search)) result = map; + } + + if(result == null){ + err("No map with name &y'{0}'&lr found.", search); return; } + info("Loading map..."); - state.mode = mode; if(arg.length > 1){ - String search = arg[1]; - for(Map map : world.maps().all()){ - if(map.name.equalsIgnoreCase(search)) - result = map; - } - - if(result == null){ - err("No map with name &y'{0}'&lr found.", search); + GameMode mode; + try{ + mode = GameMode.valueOf(arg[1]); + }catch(IllegalArgumentException e){ + err("No gamemode '{0}' found.", arg[1]); return; } - logic.reset(); - world.loadMap(result); - logic.play(); - }else{ - Log.info("&ly&fiNo map specified, so a procedural one was generated."); - playSectorMap(); + state.mode = mode; } + logic.reset(); + world.loadMap(result); + logic.play(); + }else{ - Log.info("&ly&fiNo map specified, so a procedural one was generated."); + Log.info("&ly&fiNo map specified. Loading sector {0}, {1}.", Settings.getInt("sectorid"), 0); playSectorMap(); }