Skip to content

Commit

Permalink
fix multi-couldmatcher logic mixup
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Nov 14, 2021
1 parent 4ae89dc commit db9db79
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -65,7 +65,7 @@ public static void registerCoreEvents() {
public static void registerScriptEvent(ScriptEvent event) {
events.add(event);
eventLookup.put(CoreUtilities.toLowerCase(event.getName()), event);
if (!event.eventData.anyCouldMatchRegistered) {
if (event.eventData.couldMatchers.isEmpty() || event.eventData.needsLegacy) {
legacyCouldMatchEvents.add(event);
}
}
Expand Down Expand Up @@ -115,9 +115,9 @@ public static class InternalEventData {
public HashSet<String> localSwitches = new HashSet<>();

/**
* If true, this event is inside couldMatchOptimizer.
* If true, this event needs to be in legacy event couldMatcher.
*/
public boolean anyCouldMatchRegistered = false;
public boolean needsLegacy = false;
}

/**
Expand Down Expand Up @@ -601,7 +601,9 @@ public final void registerCouldMatcher(String format) {
if (!list.contains(this)) {
list.add(this);
}
eventData.anyCouldMatchRegistered = true;
}
else {
eventData.needsLegacy = true;
}
return;
}
Expand Down

0 comments on commit db9db79

Please sign in to comment.