1
0
forked from xjboss/KCauldronX

Support to restart server after update

This commit is contained in:
Prototik
2015-06-14 19:50:18 +07:00
parent 55d1d750ec
commit 44020ecc25
7 changed files with 56 additions and 30 deletions

View File

@ -26,8 +26,12 @@ public class RestartCommand extends Command
}
return true;
}
public static void restart() {
restart(false);
}
public static void restart()
public static void restart(boolean forbidShutdown)
{
try
{
@ -98,9 +102,13 @@ public class RestartCommand extends Command
Runtime.getRuntime().addShutdownHook( shutdownHook );
} else
{
if (forbidShutdown) {
System.out.println("Attempt to restart server without restart script, decline request");
return;
}
System.out.println( "Startup script '" + SpigotConfig.restartScript + "' does not exist! Stopping server." );
}
System.exit( 0 );
cpw.mods.fml.common.FMLCommonHandler.instance().exitJava(0, false);
} catch ( Exception ex )
{
ex.printStackTrace();