Merge branch 'master' of https://github.com/Anuken/Mindustry into 4.0

# Conflicts:
#	core/assets-raw/sprites/blocks/chainturret-icon.png
#	core/assets-raw/sprites/blocks/chainturret.png
#	core/assets-raw/sprites/blocks/titancannon-icon.png
#	core/assets-raw/sprites/blocks/titancannon.png
#	core/assets/sprites/sprites.atlas
#	core/assets/sprites/sprites.png
#	core/assets/version.properties
#	core/src/io/anuke/mindustry/entities/effect/TeslaOrb.java
#	core/src/io/anuke/mindustry/graphics/BlockRenderer.java
#	core/src/io/anuke/mindustry/input/InputHandler.java
#	core/src/io/anuke/mindustry/input/PlaceMode.java
This commit is contained in:
Anuken
2018-04-21 18:47:43 -04:00
21 changed files with 759 additions and 46 deletions

View File

@@ -11,6 +11,11 @@ import io.anuke.ucore.modules.ModuleCore;
import static io.anuke.mindustry.Vars.*;
public class MindustryServer extends ModuleCore {
private String[] args;
public MindustryServer(String[] args){
this.args = args;
}
@Override
public void init(){
@@ -23,6 +28,6 @@ public class MindustryServer extends ModuleCore {
module(world = new World());
module(netServer = new NetServer());
module(netCommon = new NetCommon());
module(new ServerControl());
module(new ServerControl(args));
}
}

View File

@@ -39,7 +39,7 @@ public class ServerControl extends Module {
private final CommandHandler handler = new CommandHandler("");
private ShuffleMode mode;
public ServerControl(){
public ServerControl(String[] args){
Settings.defaultList(
"shufflemode", "normal",
"bans", "",
@@ -67,7 +67,24 @@ public class ServerControl extends Module {
@Override public void debug(String tag, String message, Throwable exception) { }
});
String[] commands = {};
if(args.length > 0){
commands = String.join(" ", args).split(",");
Log.info("&lmFound {0} command-line arguments to parse. {1}", commands.length);
}
registerCommands();
for(String s : commands){
Response response = handler.handleMessage(s);
if(response.type != ResponseType.valid){
Log.err("Invalid command argument sent: '{0}': {1}", s, response.type.name());
Log.err("Argument usage: &lc<command-1> <command1-args...>,<command-2> <command-2-args2...>");
System.exit(1);
}
}
Thread thread = new Thread(this::readCommands, "Server Controls");
thread.setDaemon(true);
thread.start();

View File

@@ -7,12 +7,12 @@ import io.anuke.mindustry.net.Net;
public class ServerLauncher{
public static void main(String[] args) throws Exception{
public static void main(String[] args){
Net.setClientProvider(new KryoClient());
Net.setServerProvider(new KryoServer());
new HeadlessApplication(new MindustryServer());
new HeadlessApplication(new MindustryServer(args));
//find and handle uncaught exceptions in libGDX thread
for(Thread thread : Thread.getAllStackTraces().keySet()){
@@ -24,6 +24,5 @@ public class ServerLauncher{
break;
}
}
}
}