mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
Fixed ShutdownHook
This commit is contained in:
parent
e79c314267
commit
aca1affe9d
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user