aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2022-12-31 03:07:01 +0100
committerGitHub <noreply@github.com>2022-12-31 03:07:01 +0100
commitac34faf4ad240448a8906ab4cc1acd0d4f0614ce (patch)
tree5640b588176de6451766c64601de745d94d13236 /src/main
parent400033abc97a281b3ca71a771734f139b7949875 (diff)
downloadNotEnoughUpdates-ac34faf4ad240448a8906ab4cc1acd0d4f0614ce.tar.gz
NotEnoughUpdates-ac34faf4ad240448a8906ab4cc1acd0d4f0614ce.tar.bz2
NotEnoughUpdates-ac34faf4ad240448a8906ab4cc1acd0d4f0614ce.zip
Probably fixing the cookie buff timer problem (#527)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: nopo <nopotheemail@gmail.com>
Diffstat (limited to 'src/main')
-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;