From 199eea5d9f47222ee667871cd9eae1d95b45dc3d Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 2 May 2018 09:21:54 +1000 Subject: [PATCH] Fixes #860 --- .../main/java/com/boydti/fawe/bukkit/BukkitMain.java | 5 +++++ core/src/main/java/com/boydti/fawe/Fawe.java | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/bukkit/src/main/java/com/boydti/fawe/bukkit/BukkitMain.java b/bukkit/src/main/java/com/boydti/fawe/bukkit/BukkitMain.java index de74d77f..59dd9342 100644 --- a/bukkit/src/main/java/com/boydti/fawe/bukkit/BukkitMain.java +++ b/bukkit/src/main/java/com/boydti/fawe/bukkit/BukkitMain.java @@ -78,4 +78,9 @@ public class BukkitMain extends JavaPlugin { Bukkit.getPluginManager().enablePlugin(toLoad); } } + + @Override + public void onDisable() { + Fawe.get().onDisable(); + } } \ No newline at end of file diff --git a/core/src/main/java/com/boydti/fawe/Fawe.java b/core/src/main/java/com/boydti/fawe/Fawe.java index 6df0334a..0b7c47ae 100644 --- a/core/src/main/java/com/boydti/fawe/Fawe.java +++ b/core/src/main/java/com/boydti/fawe/Fawe.java @@ -150,6 +150,8 @@ public class Fawe { private DefaultTransformParser transformParser; private ChatManager chatManager = new PlainChatManager(); + private BStats stats; + /** * Get the implementation specific class * @@ -222,7 +224,7 @@ public class Fawe { TaskManager.IMP = this.IMP.getTaskManager(); if (Settings.IMP.METRICS) { try { - BStats stats = new BStats(); + this.stats = new BStats(); this.IMP.startMetrics(); TaskManager.IMP.later(new Runnable() { @Override @@ -277,6 +279,12 @@ public class Fawe { } } + public void onDisable() { + if (stats != null) { + stats.close(); + } + } + private boolean update() { if (updater != null) { updater.getUpdate(IMP.getPlatform(), getVersion());