mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 19:39:07 +00:00
Fix some concurrent mod issues
This commit is contained in:
1 parent
871748a27c
commit
15efdc06c5
3 files changed
+37
-17
No files matched your search
@@ -163,16 +163,28 @@ public class Action implements IAction {
|
||||
|
||||
@Override
|
||||
public IAction getNext() {
|
||||
int idx = manager.getIndex(this);
|
||||
LinkedList<IAction> list = (LinkedList<IAction>) manager.getActionQueue();
|
||||
return (idx >= 0 && idx + 1 < list.size()) ? list.get(idx + 1) : null;
|
||||
boolean seenMe = false;
|
||||
for (IAction a : manager.getActionQueue()) {
|
||||
if (seenMe) {
|
||||
return a;
|
||||
}
|
||||
if (a == this) {
|
||||
seenMe = true;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAction getPrevious() {
|
||||
int idx = manager.getIndex(this);
|
||||
LinkedList<IAction> list = (LinkedList<IAction>) manager.getActionQueue();
|
||||
return (idx > 0) ? list.get(idx - 1) : null;
|
||||
IAction prev = null;
|
||||
for (IAction a : manager.getActionQueue()) {
|
||||
if (a == this) {
|
||||
return prev;
|
||||
}
|
||||
prev = a;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user