mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-28 12:07:38 +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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -289,10 +291,14 @@ public class CitizensNavigator implements Navigator, Runnable {
|
||||
if (!isNavigating())
|
||||
return;
|
||||
Iterator<NavigatorCallback> itr = localParams.callbacks().iterator();
|
||||
List<NavigatorCallback> callbacks = new ArrayList<NavigatorCallback>();
|
||||
while (itr.hasNext()) {
|
||||
itr.next().onCompletion(reason);
|
||||
callbacks.add(itr.next());
|
||||
itr.remove();
|
||||
}
|
||||
for (NavigatorCallback callback : callbacks) {
|
||||
callback.onCompletion(reason);
|
||||
}
|
||||
if (reason == null) {
|
||||
stopNavigating();
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user