Skip to content

Commit

Permalink
Conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAbsolutionism committed Dec 18, 2024
1 parent 139ef00 commit 9613a8b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/main/java/ch/njol/skript/sections/SecLoop.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public class SecLoop extends LoopSection {

private final transient Map<Event, Object> current = new WeakHashMap<>();
private final transient Map<Event, Iterator<?>> iteratorMap = new WeakHashMap<>();
private final transient Map<Event, Iterator<?>> currentIter = new WeakHashMap<>();
private final transient Map<Event, Object> previous = new WeakHashMap<>();

protected @Nullable TriggerItem actualNext;
Expand Down Expand Up @@ -122,13 +121,12 @@ public boolean init(Expression<?>[] exprs,
}

@Override
@Nullable
protected TriggerItem walk(Event event) {
protected @Nullable TriggerItem walk(Event event) {
Iterator<?> iter = iteratorMap.get(event);
if (iter == null) {
iter = expression instanceof Variable<?> variable ? variable.variablesIterator(event) : expr.iterator(event);
iter = expression instanceof Variable<?> variable ? variable.variablesIterator(event) : expression.iterator(event);
if (iter != null && iter.hasNext()) {
currentIter.put(event, iter);
iteratorMap.put(event, iter);
} else {
iter = null;
}
Expand Down Expand Up @@ -173,7 +171,7 @@ public String toString(@Nullable Event event, boolean debug) {
public @Nullable Object getNext(Event event) {
if (!loopPeeking)
return null;
Iterator<?> iter = currentIter.get(event);
Iterator<?> iter = iteratorMap.get(event);
if (iter == null || !iter.hasNext())
return null;
if (iter instanceof PeekingIterator<?> peekingIterator)
Expand Down Expand Up @@ -206,7 +204,6 @@ public TriggerItem getActualNext() {
public void exit(Event event) {
current.remove(event);
iteratorMap.remove(event);
currentIter.remove(event);
previous.remove(event);
super.exit(event);
}
Expand Down Expand Up @@ -244,7 +241,7 @@ public boolean supportsPeeking() {
}

public Expression<?> getExpression() {
return expr;
return expression;
}

}

0 comments on commit 9613a8b

Please sign in to comment.