From 1bbcf1c2720eaa9b4db994a511d21fd2b15e07b7 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 24 May 2014 17:10:15 +1000 Subject: [PATCH] Add an API to restart with a specific script. --- CraftBukkit-Patches/0057-Watchdog-Thread.patch | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/CraftBukkit-Patches/0057-Watchdog-Thread.patch b/CraftBukkit-Patches/0057-Watchdog-Thread.patch index f2a067f4c..3a291d088 100644 --- a/CraftBukkit-Patches/0057-Watchdog-Thread.patch +++ b/CraftBukkit-Patches/0057-Watchdog-Thread.patch @@ -1,4 +1,4 @@ -From 51fd2b3d6dc835f75d76f5a6729293f6e8768cdf Mon Sep 17 00:00:00 2001 +From 9887296b1b8adebbcdb19f7ab2e2eea28f6810d3 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 23 Feb 2013 12:33:20 +1100 Subject: [PATCH] Watchdog Thread. @@ -26,10 +26,10 @@ index 007fb86..51f1761 100644 } diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java new file mode 100644 -index 0000000..3e4203f +index 0000000..5fa56c0 --- /dev/null +++ b/src/main/java/org/spigotmc/RestartCommand.java -@@ -0,0 +1,113 @@ +@@ -0,0 +1,117 @@ +package org.spigotmc; + +import java.io.File; @@ -62,11 +62,15 @@ index 0000000..3e4203f + + public static void restart() + { ++ restart( new File( SpigotConfig.restartScript ) ); ++ } ++ ++ public static void restart(File script) ++ { + AsyncCatcher.enabled = false; // Disable async catcher incase it interferes with us + try + { -+ final File file = new File( SpigotConfig.restartScript ); -+ if ( file.isFile() ) ++ if ( script.isFile() ) + { + System.out.println( "Attempting to restart with " + SpigotConfig.restartScript ); + @@ -115,12 +119,12 @@ index 0000000..3e4203f + String os = System.getProperty( "os.name" ).toLowerCase(); + if ( os.contains( "win" ) ) + { -+ Runtime.getRuntime().exec( "cmd /c start " + file.getPath() ); ++ Runtime.getRuntime().exec( "cmd /c start " + script.getPath() ); + } else + { + Runtime.getRuntime().exec( new String[] + { -+ "sh", file.getPath() ++ "sh", script.getPath() + } ); + } + } catch ( Exception e )