aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java3
2 files changed, 12 insertions, 5 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java
index ab8c5e57..80751371 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java
@@ -30,6 +30,7 @@ import net.minecraft.util.EnumChatFormatting;
public class CookieWarning {
private static boolean hasNotified;
+ private static boolean hasErrorMessage;
public static void resetNotification() {
hasNotified = false;
@@ -74,7 +75,9 @@ public class CookieWarning {
return;
}
if (timeLine != null) {
- String[] digits = timeLine.replaceAll("(\u00a7.)", "").split(" ");
+ String clean = timeLine.replaceAll("(\u00a7.)", "");
+ clean = clean.replaceAll("(\\d)([smhdy])", "$1 $2");
+ String[] digits = clean.split(" ");
int minutes = 0;
try {
for (int i = 0; i < digits.length; i++) {
@@ -109,9 +112,12 @@ public class CookieWarning {
} // ignore seconds
}
} catch (NumberFormatException e) {
- e.printStackTrace();
- Utils.addChatMessage(EnumChatFormatting.RED +
- "NEU ran into an issue when retrieving the Booster Cookie Timer. Check the logs for details.");
+ if (!hasErrorMessage) {
+ e.printStackTrace();
+ Utils.addChatMessage(EnumChatFormatting.RED +
+ "NEU ran into an issue when retrieving the Booster Cookie Timer. Check the logs for details.");
+ hasErrorMessage = true;
+ }
hasNotified = true;
}
if (minutes < NotEnoughUpdates.INSTANCE.config.notifications.boosterCookieWarningMins && !hasNotified) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
index 74c64972..6e20c77d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
@@ -344,9 +344,9 @@ public class TimersOverlay extends TextTabOverlay {
}
}
} catch (Exception e) {
- e.printStackTrace();
if (!hasErrorMessage) {
Utils.addChatMessage(EnumChatFormatting.YELLOW + "[NEU] Unable to work out your god pot timer");
+ e.printStackTrace();
hasErrorMessage = true;
}
break;
@@ -358,6 +358,7 @@ public class TimersOverlay extends TextTabOverlay {
foundCookieBuffText = true;
} else if (foundCookieBuffText) {
String clean = line.replaceAll("(\u00a7.)", "");
+ clean = clean.replaceAll("(\\d)([smhdy])", "$1 $2");
String[] cleanSplit = clean.split(" ");
hidden.cookieBuffRemaining = 0;
if (line.contains("Not")) break;