mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-02 07:33:44 +01:00
Fix rare error with certain delay trigger setups, for #1630
This commit is contained in:
parent
eea6e83e83
commit
8e9eb3d373
@ -1,6 +1,8 @@
|
|||||||
package net.citizensnpcs.npc.ai;
|
package net.citizensnpcs.npc.ai;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -289,10 +291,14 @@ public class CitizensNavigator implements Navigator, Runnable {
|
|||||||
if (!isNavigating())
|
if (!isNavigating())
|
||||||
return;
|
return;
|
||||||
Iterator<NavigatorCallback> itr = localParams.callbacks().iterator();
|
Iterator<NavigatorCallback> itr = localParams.callbacks().iterator();
|
||||||
|
List<NavigatorCallback> callbacks = new ArrayList<NavigatorCallback>();
|
||||||
while (itr.hasNext()) {
|
while (itr.hasNext()) {
|
||||||
itr.next().onCompletion(reason);
|
callbacks.add(itr.next());
|
||||||
itr.remove();
|
itr.remove();
|
||||||
}
|
}
|
||||||
|
for (NavigatorCallback callback : callbacks) {
|
||||||
|
callback.onCompletion(reason);
|
||||||
|
}
|
||||||
if (reason == null) {
|
if (reason == null) {
|
||||||
stopNavigating();
|
stopNavigating();
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user