diff options
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.java | 14 |
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) { |
