From 566b5c93a6362a07fbe8ca098949de7c1074a8f7 Mon Sep 17 00:00:00 2001 From: Timothy Southwick Date: Fri, 1 May 2026 21:07:24 -0400 Subject: [PATCH 1/3] Reference world by name instead of object --- .../scriptedquests/utils/WorldRegexMatcher.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/src/main/java/com/playmonumenta/scriptedquests/utils/WorldRegexMatcher.java b/plugin/src/main/java/com/playmonumenta/scriptedquests/utils/WorldRegexMatcher.java index cc8560ba..3d02ef30 100644 --- a/plugin/src/main/java/com/playmonumenta/scriptedquests/utils/WorldRegexMatcher.java +++ b/plugin/src/main/java/com/playmonumenta/scriptedquests/utils/WorldRegexMatcher.java @@ -11,7 +11,7 @@ public class WorldRegexMatcher { private final Map mPatterns = new HashMap<>(); - private final Map> mWorldPatternMatches = new HashMap<>(); + private final Map> mWorldPatternMatches = new HashMap<>(); public WorldRegexMatcher(Set worldRegexes) throws PatternSyntaxException { for (String worldRegexStr : worldRegexes) { @@ -25,7 +25,7 @@ public WorldRegexMatcher(Set worldRegexes) throws PatternSyntaxException public void onLoadWorld(World world) { Set matchingPatterns = new HashSet<>(); - mWorldPatternMatches.put(world, matchingPatterns); + mWorldPatternMatches.put(world.getName(), matchingPatterns); String worldName = world.getName(); for (Map.Entry entry : mPatterns.entrySet()) { @@ -42,12 +42,12 @@ public void onLoadWorld(World world) { } public void onUnloadWorld(World world) { - mWorldPatternMatches.remove(world); + mWorldPatternMatches.remove(world.getName()); } // Only works for the patterns provided at matcher instantiation public boolean matches(World world, String worldRegex) { - Set matches = mWorldPatternMatches.get(world); + Set matches = mWorldPatternMatches.get(world.getName()); if (matches == null) { MMLog.warning("Falling back to slow regex .matches() to test world: '" + world.getName() + "' against unregistered regex: '" + worldRegex + "'"); try { From 10cf8e55aad28883ef82a722ab140942dd3527df Mon Sep 17 00:00:00 2001 From: Timothy Southwick Date: Sat, 2 May 2026 08:38:52 -0400 Subject: [PATCH 2/3] Corrected warning about handling unloaded worlds; added exception purely to identify checks against unloaded worlds --- .../scriptedquests/utils/WorldRegexMatcher.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/com/playmonumenta/scriptedquests/utils/WorldRegexMatcher.java b/plugin/src/main/java/com/playmonumenta/scriptedquests/utils/WorldRegexMatcher.java index 3d02ef30..88d79503 100644 --- a/plugin/src/main/java/com/playmonumenta/scriptedquests/utils/WorldRegexMatcher.java +++ b/plugin/src/main/java/com/playmonumenta/scriptedquests/utils/WorldRegexMatcher.java @@ -49,7 +49,10 @@ public void onUnloadWorld(World world) { public boolean matches(World world, String worldRegex) { Set matches = mWorldPatternMatches.get(world.getName()); if (matches == null) { - MMLog.warning("Falling back to slow regex .matches() to test world: '" + world.getName() + "' against unregistered regex: '" + worldRegex + "'"); + MMLog.warning( + "Falling back to slow regex .matches() to test unloaded world: '" + world.getName() + "' against regex: '" + worldRegex + "'", + new IllegalStateException("WorldRegexMatcher testing against an unloaded world") + ); try { return world.getName().matches(worldRegex); } catch (PatternSyntaxException e) { From d1f95e6568fe52a460ef6e33ce917d7f08518eeb Mon Sep 17 00:00:00 2001 From: Byron Marohn Date: Wed, 6 May 2026 19:20:33 -0700 Subject: [PATCH 3/3] Upgraded severity to severe so exception logger will catch it --- .../playmonumenta/scriptedquests/utils/WorldRegexMatcher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/src/main/java/com/playmonumenta/scriptedquests/utils/WorldRegexMatcher.java b/plugin/src/main/java/com/playmonumenta/scriptedquests/utils/WorldRegexMatcher.java index 88d79503..102b946a 100644 --- a/plugin/src/main/java/com/playmonumenta/scriptedquests/utils/WorldRegexMatcher.java +++ b/plugin/src/main/java/com/playmonumenta/scriptedquests/utils/WorldRegexMatcher.java @@ -49,7 +49,7 @@ public void onUnloadWorld(World world) { public boolean matches(World world, String worldRegex) { Set matches = mWorldPatternMatches.get(world.getName()); if (matches == null) { - MMLog.warning( + MMLog.severe( "Falling back to slow regex .matches() to test unloaded world: '" + world.getName() + "' against regex: '" + worldRegex + "'", new IllegalStateException("WorldRegexMatcher testing against an unloaded world") );