Fixed ShutdownHook

This commit is contained in:
Rsl1122 2017-11-06 15:00:18 +02:00
parent e79c314267
commit aca1affe9d
2 changed files with 8 additions and 1 deletions

View File

@ -24,7 +24,9 @@ import com.djrapitops.plugin.StaticHolder;
import com.djrapitops.plugin.api.Benchmark;
import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.api.config.Config;
import com.djrapitops.plugin.api.systems.TaskCenter;
import com.djrapitops.plugin.api.utility.Version;
import com.djrapitops.plugin.api.utility.log.DebugLog;
import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.settings.ColorScheme;
import com.djrapitops.plugin.task.AbsRunnable;
@ -223,6 +225,7 @@ public class Plan extends BukkitPlugin implements IPlan {
Benchmark.stop("Enable", "Enable");
Log.logDebug("Enable");
Log.info(Locale.get(Msg.ENABLED).toString());
StaticHolder.saveInstance(ShutdownHook.class, this.getClass());
new ShutdownHook(this);
} catch (Exception e) {
Log.error("Plugin Failed to Initialize Correctly.");
@ -321,7 +324,9 @@ public class Plan extends BukkitPlugin implements IPlan {
}
}
Log.info(Locale.get(Msg.DISABLED).toString());
super.onDisable();
Benchmark.pluginDisabled(Plan.class);
DebugLog.pluginDisabled(Plan.class);
TaskCenter.cancelAllKnownTasks(Plan.class);
}
@Override

View File

@ -4,6 +4,7 @@
*/
package main.java.com.djrapitops.plan;
import com.djrapitops.plugin.StaticHolder;
import com.djrapitops.plugin.api.utility.log.Log;
import main.java.com.djrapitops.plan.api.exceptions.DatabaseInitException;
import main.java.com.djrapitops.plan.data.Action;
@ -69,6 +70,7 @@ public class ShutdownHook extends Thread {
}
db = null;
dataCache = null;
StaticHolder.unRegister(Plan.class);
}
}