diff options
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/util')
3 files changed, 59 insertions, 10 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/util/ServerRestartUtil.java b/src/main/java/com/keuin/kbackupfabric/util/ServerRestartUtil.java new file mode 100644 index 0000000..1642e5c --- /dev/null +++ b/src/main/java/com/keuin/kbackupfabric/util/ServerRestartUtil.java @@ -0,0 +1,58 @@ +package com.keuin.kbackupfabric.util; + +public class ServerRestartUtil { + + public static void forkAndRestart() { +// Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { +// @Override +// public void run() { +// // Here we restart the minecraft server +// StringBuilder cmd = new StringBuilder(); +// cmd.append(System.getProperty("java.home")).append(File.separator).append("bin").append(File.separator).append("java "); +// for (String jvmArg : ManagementFactory.getRuntimeMXBean().getInputArguments()) { +// cmd.append(jvmArg + " "); +// } +// cmd.append("-cp ").append(ManagementFactory.getRuntimeMXBean().getClassPath()).append(" "); +// cmd.append(MinecraftServer.class.getName()).append(" "); +// for (String arg : args) { +// cmd.append(arg).append(" "); +// } +// Runtime.getRuntime().exec(cmd.toString()); +// System.exit(0); +// } +// })); + } + + private static void startRestartThread() { +// (new Thread(() -> { +// +// +// // kill threads +// Set<Thread> threads = Thread.getAllStackTraces().keySet(); +// Thread currentThread = Thread.currentThread(); +// for (Thread t : threads) { +// if(t != currentThread && t.isAlive()) { +// t.setUncaughtExceptionHandler((t1, e) -> { +// // set empty handler +// }); +// //t.interrupt(); +// try { +// t.setDaemon(true); +// } catch (Exception ignored) { +// } +// +// t.stop(); +// } +// } +// +// try { +// Thread.sleep(5000); +// } catch (InterruptedException ignored) { +// } +// +// // restart Minecraft server +// String[] args = new String[]{}; +// MinecraftServer.main(args); +// })).start(); + } +} diff --git a/src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java b/src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java index ee2907e..11b912e 100644 --- a/src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java +++ b/src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java @@ -1,5 +1,6 @@ package com.keuin.kbackupfabric.util; +import com.keuin.kbackupfabric.exception.ZipUtilException; import com.keuin.kbackupfabric.metadata.BackupMetadata; import java.io.*; diff --git a/src/main/java/com/keuin/kbackupfabric/util/ZipUtilException.java b/src/main/java/com/keuin/kbackupfabric/util/ZipUtilException.java deleted file mode 100644 index b31272d..0000000 --- a/src/main/java/com/keuin/kbackupfabric/util/ZipUtilException.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.keuin.kbackupfabric.util; - -public class ZipUtilException extends Exception { - public ZipUtilException() { - } - - public ZipUtilException(String gripe) { - super(gripe); - } -} |