diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2021-08-22 16:40:43 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2021-08-22 16:40:43 +0200 |
commit | edaeda189cdad59fbb905a7c67d7b2350976b4eb (patch) | |
tree | 1dbe6c86a0af7b0ca9b541400f8c4d7e8274e507 /src/main | |
parent | 6899df634766e2a8666ac7f45cac1008da140c4e (diff) | |
download | NotEnoughUpdates-edaeda189cdad59fbb905a7c67d7b2350976b4eb.tar.gz NotEnoughUpdates-edaeda189cdad59fbb905a7c67d7b2350976b4eb.tar.bz2 NotEnoughUpdates-edaeda189cdad59fbb905a7c67d7b2350976b4eb.zip |
fix
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java index d6ec1d98..c1a1d227 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java @@ -24,8 +24,9 @@ public class DivanMinesOverlay extends TextOverlay { private static final Minecraft mc = Minecraft.getMinecraft(); private final StorageManager storageManager = StorageManager.getInstance(); private final Pattern notFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Talk to me when you have found a (?<item>[a-z-A-Z ]+)!"); - private final Pattern foundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (Excellent! You have returned the|You have already restored this Dwarf's) (?<item>[a-z-A-Z ]+)(!| to its rightful place!)"); + private final Pattern foundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Excellent! You have returned the (?<item>[a-z-A-Z ]+) to its rightful place!"); private final Pattern resetPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (You haven't placed the Jade Crystal yet!|You found all of the items! Behold\\.\\.\\. the Jade Crystal!|You have already placed the Jade Crystal!)"); + private final Pattern alreadyFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: You have already restored this Dwarf's (?<item>[a-z-A-Z ]+)!"); static { items = new HashMap<>(); @@ -86,16 +87,18 @@ public class DivanMinesOverlay extends TextOverlay { public void message(String message) { Matcher foundMatcher = foundPattern.matcher(message); + Matcher alreadyFoundMatcher = alreadyFoundPattern.matcher(message); Matcher notFoundMatcher = notFoundPattern.matcher(message); Matcher resetMatcher = resetPattern.matcher(message); System.out.println(message); - if (foundMatcher.matches() && items.containsKey(foundMatcher.group("item"))) { + if (foundMatcher.matches() && items.containsKey(foundMatcher.group("item"))) items.put(foundMatcher.group("item"), true); - } else if (notFoundMatcher.matches() && items.containsKey(notFoundMatcher.group("item"))) { + else if (notFoundMatcher.matches() && items.containsKey(notFoundMatcher.group("item"))) items.put(notFoundMatcher.group("item"), false); - } else if (resetMatcher.matches()) { + else if (resetMatcher.matches()) items.replaceAll((k, v) -> false); - } + else if (alreadyFoundMatcher.matches() && items.containsKey(alreadyFoundMatcher.group("item"))) + items.put(alreadyFoundMatcher.group("item"), true); } @Override |