From 28bb51be35ecbb0a294daeb04973f8a7389d4dcf Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 8 Jan 2020 18:29:43 +0100 Subject: [PATCH] Adding new serverstart option for startup change --- src/de/steamwar/bungeecore/Subserver.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/Subserver.java b/src/de/steamwar/bungeecore/Subserver.java index 797de0c..7df9b1f 100644 --- a/src/de/steamwar/bungeecore/Subserver.java +++ b/src/de/steamwar/bungeecore/Subserver.java @@ -52,20 +52,22 @@ public class Subserver implements Runnable { } 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.serverName = serverName; this.type = type; this.shutdownCallback = shutdownCallback; - ProcessBuilder pb = new ProcessBuilder(command); - InetSocketAddress address = new InetSocketAddress("127.0.0.1", port); - try{ - this.p = pb.start(); + this.p = processBuilder.start(); }catch(IOException e){ throw new SecurityException("Server could not be started", e); } + InetSocketAddress address = new InetSocketAddress("127.0.0.1", port); this.server = ProxyServer.getInstance().constructServerInfo( serverName, address, "SteamWar.de - Subserver", false); this.writer = new PrintWriter(p.getOutputStream(), true);