Merging of map saves
This commit is contained in:
@@ -19,6 +19,7 @@ public class MindustryServer implements ApplicationListener{
|
||||
@Override
|
||||
public void init(){
|
||||
Core.settings.setDataDirectory(Core.files.local("config"));
|
||||
loadLocales = false;
|
||||
Vars.init();
|
||||
|
||||
headless = true;
|
||||
|
||||
@@ -235,7 +235,7 @@ public class ServerControl implements ApplicationListener{
|
||||
info("Loading map...");
|
||||
|
||||
logic.reset();
|
||||
state.rules = preset.get();
|
||||
state.rules = preset.apply(result.rules());
|
||||
try{
|
||||
world.loadMap(result);
|
||||
logic.play();
|
||||
@@ -357,6 +357,16 @@ public class ServerControl implements ApplicationListener{
|
||||
}
|
||||
});
|
||||
|
||||
handler.register("name", "[name...]", "Change the server display name.", arg -> {
|
||||
if(arg.length == 0){
|
||||
info("Server name is currently &lc'{0}'.", Core.settings.getString("servername"));
|
||||
return;
|
||||
}
|
||||
Core.settings.put("servername", arg[0]);
|
||||
Core.settings.save();
|
||||
info("Server name is now &lc'{0}'.", arg[0]);
|
||||
});
|
||||
|
||||
handler.register("crashreport", "<on/off>", "Disables or enables automatic crash reporting", arg -> {
|
||||
boolean value = arg[0].equalsIgnoreCase("on");
|
||||
Core.settings.put("crashreport", value);
|
||||
|
||||
@@ -1,38 +1,18 @@
|
||||
package io.anuke.mindustry.server;
|
||||
|
||||
|
||||
import io.anuke.arc.ApplicationListener;
|
||||
import io.anuke.arc.backends.headless.HeadlessApplication;
|
||||
import io.anuke.arc.backends.headless.HeadlessApplicationConfiguration;
|
||||
import io.anuke.mindustry.net.CrashSender;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.ArcNetClient;
|
||||
import io.anuke.mindustry.net.ArcNetServer;
|
||||
import io.anuke.mindustry.net.*;
|
||||
|
||||
public class ServerLauncher extends HeadlessApplication{
|
||||
|
||||
public ServerLauncher(ApplicationListener listener, HeadlessApplicationConfiguration config){
|
||||
super(listener, config);
|
||||
}
|
||||
public class ServerLauncher{
|
||||
|
||||
public static void main(String[] args){
|
||||
try{
|
||||
|
||||
Net.setClientProvider(new ArcNetClient());
|
||||
Net.setServerProvider(new ArcNetServer());
|
||||
|
||||
HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration();
|
||||
new ServerLauncher(new MindustryServer(args), config);
|
||||
new HeadlessApplication(new MindustryServer(args), null, throwable -> CrashSender.send(throwable, f -> {}));
|
||||
}catch(Throwable t){
|
||||
CrashSender.send(t, f -> {});
|
||||
}
|
||||
|
||||
//find and handle uncaught exceptions in libGDX thread
|
||||
for(Thread thread : Thread.getAllStackTraces().keySet()){
|
||||
if(thread.getName().equals("HeadlessApplication")){
|
||||
thread.setUncaughtExceptionHandler((t, throwable) -> CrashSender.send(throwable, f -> {}));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user