aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java
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/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java
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/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java14
1 files changed, 10 insertions, 4 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) {