mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-28 12:07:35 +01:00
Fixed Crash on disable if calling ProcessingQueue methods (#515)
This commit is contained in:
parent
b52782298e
commit
db81d34214
@ -34,6 +34,7 @@ import com.djrapitops.plugin.api.systems.TaskCenter;
|
|||||||
import com.djrapitops.plugin.api.utility.log.DebugLog;
|
import com.djrapitops.plugin.api.utility.log.DebugLog;
|
||||||
import com.djrapitops.plugin.api.utility.log.Log;
|
import com.djrapitops.plugin.api.utility.log.Log;
|
||||||
import com.djrapitops.plugin.settings.ColorScheme;
|
import com.djrapitops.plugin.settings.ColorScheme;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,7 +101,10 @@ public class Plan extends BukkitPlugin implements PlanPlugin {
|
|||||||
Log.info(Locale.get(Msg.DISABLED).toString());
|
Log.info(Locale.get(Msg.DISABLED).toString());
|
||||||
Benchmark.pluginDisabled(Plan.class);
|
Benchmark.pluginDisabled(Plan.class);
|
||||||
DebugLog.pluginDisabled(Plan.class);
|
DebugLog.pluginDisabled(Plan.class);
|
||||||
TaskCenter.cancelAllKnownTasks(Plan.class);
|
if (!reloading) {
|
||||||
|
TaskCenter.cancelAllKnownTasks(Plan.class);
|
||||||
|
Bukkit.getScheduler().cancelTasks(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,6 +23,5 @@ public class BukkitDBSystem extends DBSystem {
|
|||||||
|
|
||||||
String dbType = Settings.DB_TYPE.toString().toLowerCase().trim();
|
String dbType = Settings.DB_TYPE.toString().toLowerCase().trim();
|
||||||
db = getActiveDatabaseByName(dbType);
|
db = getActiveDatabaseByName(dbType);
|
||||||
db.init();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,6 +12,7 @@ import java.util.concurrent.BlockingQueue;
|
|||||||
*/
|
*/
|
||||||
public abstract class Queue<T> {
|
public abstract class Queue<T> {
|
||||||
|
|
||||||
|
protected boolean run = true;
|
||||||
protected final BlockingQueue<T> queue;
|
protected final BlockingQueue<T> queue;
|
||||||
protected Setup<T> setup;
|
protected Setup<T> setup;
|
||||||
|
|
||||||
@ -30,7 +31,9 @@ public abstract class Queue<T> {
|
|||||||
* @param object Object to add.
|
* @param object Object to add.
|
||||||
*/
|
*/
|
||||||
public void add(T object) {
|
public void add(T object) {
|
||||||
queue.add(object);
|
if (run) {
|
||||||
|
queue.add(object);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,6 +42,7 @@ public abstract class Queue<T> {
|
|||||||
* @return List of unprocessed objects.
|
* @return List of unprocessed objects.
|
||||||
*/
|
*/
|
||||||
public List<T> stopAndReturnLeftovers() {
|
public List<T> stopAndReturnLeftovers() {
|
||||||
|
run = false;
|
||||||
try {
|
try {
|
||||||
if (setup != null) {
|
if (setup != null) {
|
||||||
setup.stop();
|
setup.stop();
|
||||||
@ -54,6 +58,7 @@ public abstract class Queue<T> {
|
|||||||
* Stops all activity and clears the queue.
|
* Stops all activity and clears the queue.
|
||||||
*/
|
*/
|
||||||
public void stop() {
|
public void stop() {
|
||||||
|
run = false;
|
||||||
if (setup != null) {
|
if (setup != null) {
|
||||||
setup.stop();
|
setup.stop();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user