mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 08:36:45 +01:00
Run tasks synchronously on Bukkit when the plugin is disabled.
Previously, the tasks would fail to run, as the scheduler prevents disabled plugins from running tasks. This would cause problems on server shutdown, especially when the SQLManager attempts to perform database queries. This fixes #2446.
This commit is contained in:
parent
37280779b0
commit
a221d6fd07
@ -24,8 +24,12 @@ public class BukkitTaskManager extends TaskManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public void taskAsync(Runnable runnable) {
|
@Override public void taskAsync(Runnable runnable) {
|
||||||
this.bukkitMain.getServer().getScheduler().runTaskAsynchronously(this.bukkitMain, runnable)
|
if (this.bukkitMain.isEnabled()) {
|
||||||
.getTaskId();
|
this.bukkitMain.getServer().getScheduler()
|
||||||
|
.runTaskAsynchronously(this.bukkitMain, runnable).getTaskId();
|
||||||
|
} else {
|
||||||
|
runnable.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void task(Runnable runnable) {
|
@Override public void task(Runnable runnable) {
|
||||||
|
Loading…
Reference in New Issue
Block a user