diff --git a/Auto-Tune/src/unprotesting/com/github/Main.java b/Auto-Tune/src/unprotesting/com/github/Main.java index 266a634..62304f1 100644 --- a/Auto-Tune/src/unprotesting/com/github/Main.java +++ b/Auto-Tune/src/unprotesting/com/github/Main.java @@ -183,9 +183,11 @@ public void onDisable() { if (getINSTANCE() == null){ INSTANCE = this; } - scheduler.cancelTasks(getINSTANCE()); - server.stop(3); + if (server != null){ + server.stop(0); + } closeDataFiles(); + scheduler.cancelTasks(getINSTANCE()); log.info(String.format("[%s] Disabled Version %s", getDescription().getName(), getDescription().getVersion())); } @@ -215,7 +217,6 @@ public void onEnable() { server.setExecutor(null); server.start(); log.info("[Auto Tune] Web server has started on port " + Config.getPort()); - } catch (IOException e) { log( "Error Creating Server on port: " + Config.getPort() + ". Please try restarting or changing your port."); @@ -473,14 +474,14 @@ public static void setupDataFiles() { public static void closeDataFiles(){ db.commit(); - enchDB.commit(); - tempDB.commit(); - loanDB.commit(); db.close(); - memDB.close(); + enchDB.commit(); enchDB.close(); + tempDB.commit(); tempDB.close(); + loanDB.commit(); loanDB.close(); + memDB.close(); } public static void loadTopMovers(){ diff --git a/Auto-Tune/src/unprotesting/com/github/util/StaticFileHandler.java b/Auto-Tune/src/unprotesting/com/github/util/StaticFileHandler.java index ccc9a81..8137413 100644 --- a/Auto-Tune/src/unprotesting/com/github/util/StaticFileHandler.java +++ b/Auto-Tune/src/unprotesting/com/github/util/StaticFileHandler.java @@ -34,7 +34,6 @@ public void handle(HttpExchange ex) throws IOException { ex.sendResponseHeaders(404, 0); out.write("404 File not found.".getBytes()); } - out.close(); }