Fix an rare case when running task before setting variable

Fix #1310
This commit is contained in:
sandtechnology committed 2021-07-17 01:18:52 +08:00
1 parent bde33d05d4
commit a6e18f58e7
1 file changed
+3 -2
@@ -81,10 +81,11 @@ public class AsyncPacketSender {
//lazy initialize
if (asyncSendingTask == null || asyncSendingTask.isCancelled()) {
asyncSendingTask = plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, () -> {
if (asyncSendingTask.isCancelled()) {
//Variable haven set yet
if (asyncSendingTask == null) {
return;
}
if (!taskDone.get()) {
if (!taskDone.get() || asyncSendingTask.isCancelled()) {
return;
}
taskDone.set(false);