9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-28 19:39:17 +00:00

cancel async target finding when entity removal

This commit is contained in:
hayanesuru
2025-07-04 15:52:10 +09:00
parent 8e2a94a7d2
commit a80d2bd374
3 changed files with 30 additions and 11 deletions

View File

@@ -9,6 +9,7 @@ public class Waker {
public volatile VWaker wake = null;
@Nullable
public volatile Object result = null;
private volatile boolean cancel = false;
public boolean state = true;
public final @Nullable Object result() {
@@ -18,6 +19,7 @@ public class Waker {
}
public final void cancel() {
this.cancel = true;
this.wake = null;
this.result = null;
}
@@ -31,6 +33,9 @@ public class Waker {
AsyncGoalExecutor.LOGGER.error("Exception while wake", e);
}
this.wake = null;
if (this.cancel) {
this.result = null;
}
}
}
}