1
0

Adding new serverstart option for startup change

Dieser Commit ist enthalten in:
Lixfel 2020-01-08 18:29:43 +01:00
Ursprung bfb409f2c6
Commit 28bb51be35

Datei anzeigen

@ -52,20 +52,22 @@ public class Subserver implements Runnable {
} }
public Subserver(Servertype type, String serverName, int port, Runnable shutdownCallback, String... command){ public Subserver(Servertype type, String serverName, int port, Runnable shutdownCallback, String... command){
this(type, serverName, port, new ProcessBuilder(command), shutdownCallback);
}
public Subserver(Servertype type, String serverName, int port, ProcessBuilder processBuilder, Runnable shutdownCallback){
this.started = false; this.started = false;
this.serverName = serverName; this.serverName = serverName;
this.type = type; this.type = type;
this.shutdownCallback = shutdownCallback; this.shutdownCallback = shutdownCallback;
ProcessBuilder pb = new ProcessBuilder(command);
InetSocketAddress address = new InetSocketAddress("127.0.0.1", port);
try{ try{
this.p = pb.start(); this.p = processBuilder.start();
}catch(IOException e){ }catch(IOException e){
throw new SecurityException("Server could not be started", e); throw new SecurityException("Server could not be started", e);
} }
InetSocketAddress address = new InetSocketAddress("127.0.0.1", port);
this.server = ProxyServer.getInstance().constructServerInfo( this.server = ProxyServer.getInstance().constructServerInfo(
serverName, address, "SteamWar.de - Subserver", false); serverName, address, "SteamWar.de - Subserver", false);
this.writer = new PrintWriter(p.getOutputStream(), true); this.writer = new PrintWriter(p.getOutputStream(), true);