mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-10 07:47:25 +07:00
Added openServer method
This commit is contained in:
@ -251,7 +251,7 @@ public class ServerControl implements ApplicationListener{
|
||||
|
||||
info("Map loaded.");
|
||||
|
||||
host();
|
||||
netServer.openServer();
|
||||
}catch(MapException e){
|
||||
Log.err(e.map.name() + ": " + e.getMessage());
|
||||
}
|
||||
@ -711,8 +711,8 @@ public class ServerControl implements ApplicationListener{
|
||||
SaveIO.load(file);
|
||||
state.rules.zone = null;
|
||||
info("Save loaded.");
|
||||
host();
|
||||
state.set(State.playing);
|
||||
netServer.openServer();
|
||||
}catch(Throwable t){
|
||||
err("Failed to load save. Outdated or corrupt file.");
|
||||
}
|
||||
@ -869,19 +869,6 @@ public class ServerControl implements ApplicationListener{
|
||||
}
|
||||
}
|
||||
|
||||
private void host(){
|
||||
try{
|
||||
net.host(Config.port.num());
|
||||
info("&lcOpened a server on port {0}.", Config.port.num());
|
||||
}catch(BindException e){
|
||||
Log.err("Unable to host: Port already in use! Make sure no other servers are running on the same port in your network.");
|
||||
state.set(State.menu);
|
||||
}catch(IOException e){
|
||||
err(e);
|
||||
state.set(State.menu);
|
||||
}
|
||||
}
|
||||
|
||||
private void logToFile(String text){
|
||||
if(currentLogFile != null && currentLogFile.length() > maxLogLength){
|
||||
String date = DateTimeFormatter.ofPattern("MM-dd-yyyy | HH:mm:ss").format(LocalDateTime.now());
|
||||
|
Reference in New Issue
Block a user