Skip to content

Commit

Permalink
Fixed reloading the plugin
Browse files Browse the repository at this point in the history
+ Fixed reloading the plugin and some stability bugs when restarting
  • Loading branch information
noahbclarkson committed Dec 24, 2020
1 parent ba4eba9 commit 91a02bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
15 changes: 8 additions & 7 deletions Auto-Tune/src/unprotesting/com/github/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}

Expand Down Expand Up @@ -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.");
Expand Down Expand Up @@ -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(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public void handle(HttpExchange ex) throws IOException {
ex.sendResponseHeaders(404, 0);
out.write("404 File not found.".getBytes());
}

out.close();
}

Expand Down

0 comments on commit 91a02bb

Please sign in to comment.