diff options
| author | Lulonaut <67191924+Lulonaut@users.noreply.github.com> | 2022-06-22 14:41:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-22 14:41:15 +0200 |
| commit | f34220a92af85a33d979edb24ac5c3e698498fe3 (patch) | |
| tree | d36bcc12b1fd4116003c1c36cb09666f0e3f36c1 /src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java | |
| parent | 439fc22ff04b0f5b0201c2d982bceb18d82fd553 (diff) | |
| download | notenoughupdates-f34220a92af85a33d979edb24ac5c3e698498fe3.tar.gz notenoughupdates-f34220a92af85a33d979edb24ac5c3e698498fe3.tar.bz2 notenoughupdates-f34220a92af85a33d979edb24ac5c3e698498fe3.zip | |
bug fixes (#172)
* yikes
* cookie warning
* better wording in docs
* edit items in parent that are the bounds of the item list
* totalCount not updating when not present
* unplayable
* comment?
* outdated repo notification
* more notification
* crash
* more crash
* cookie bug
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 | 28 |
1 files changed, 11 insertions, 17 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 2aec0fbe..ca1865cd 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java @@ -26,34 +26,23 @@ import io.github.moulberry.notenoughupdates.util.NotificationHandler; import net.minecraft.client.Minecraft; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.event.entity.EntityJoinWorldEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class CookieWarning { private static boolean hasNotified; - public CookieWarning() { - hasNotified = false; - } - - @SubscribeEvent - public void onJoinWorld(EntityJoinWorldEvent e) { - if (e.entity == Minecraft.getMinecraft().thePlayer) { - this.checkCookie(); - } - } - public static void resetNotification() { hasNotified = false; + NotificationHandler.cancelNotification(); } /** - * Checks the tab list for a cookie timer, and sends a chat message if the timer is within the tolerance + * Checks the tab list for a cookie timer, and sends a notification if the timer is within the tolerance */ - private void checkCookie() { - if (!hasNotified && NotEnoughUpdates.INSTANCE.config.notifications.doBoosterNotif) { - String[] lines = {}; + public static void checkCookie() { + if (NotEnoughUpdates.INSTANCE.config.notifications.doBoosterNotif && + NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) { + String[] lines; try { lines = ((AccessorGuiPlayerTabOverlay) Minecraft.getMinecraft().ingameGUI.getTabList()) .getFooter() @@ -106,6 +95,7 @@ public class CookieWarning { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( EnumChatFormatting.RED + "NEU ran into an issue when retrieving the Booster Cookie Timer. Check the logs for details.")); + hasNotified = true; } if (minutes < NotEnoughUpdates.INSTANCE.config.notifications.boosterCookieWarningMins) { NotificationHandler.displayNotification(Lists.newArrayList( @@ -115,8 +105,12 @@ public class CookieWarning { "\u00a77Press X on your keyboard to close this notification" ), true, true); hasNotified = true; + } else if (hasNotified) { + NotificationHandler.cancelNotification(); + hasNotified = false; } } } + } } |
