From b3e37c2d62a141e01985b53b8a24f998a825ca60 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 1 Sep 2019 16:18:16 +0200 Subject: [PATCH] Terminating server if no shutdown after 60 seconds --- src/de/steamwar/bungeecore/Subserver.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/Subserver.java b/src/de/steamwar/bungeecore/Subserver.java index 377b91f..523550d 100644 --- a/src/de/steamwar/bungeecore/Subserver.java +++ b/src/de/steamwar/bungeecore/Subserver.java @@ -12,6 +12,7 @@ import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; +import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; @@ -27,6 +28,12 @@ public class Subserver implements Runnable { } return null; } + public static Subserver getSubserver(ServerInfo server){ + for(Subserver s : serverList) + if(s.server == server) + return s; + return null; + } public static List getServerList(){ return serverList; } @@ -81,7 +88,8 @@ public class Subserver implements Runnable { public void stop(){ writer.println("stop"); try { - p.waitFor(); + if(!p.waitFor(1, TimeUnit.MINUTES)) + p.destroy(); }catch(InterruptedException e){ logger.log(Level.SEVERE, "Subserver stop interrupted!", e); Thread.currentThread().interrupt();