diff options
author | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2024-03-04 04:08:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 04:08:32 +0000 |
commit | c1359d6c542c4756e5a283d557a4c3980a1281ba (patch) | |
tree | cf5d82d8f78184f22a962a260b20674b341c2b1b /src/main/java/de/hysky/skyblocker/skyblock | |
parent | e40858676ff0cee3c00b2ed3938e6995ea50899a (diff) | |
parent | 6bb1d5a5a7489295949ceba846ca41781beac468 (diff) | |
download | Skyblocker-c1359d6c542c4756e5a283d557a4c3980a1281ba.tar.gz Skyblocker-c1359d6c542c4756e5a283d557a4c3980a1281ba.tar.bz2 Skyblocker-c1359d6c542c4756e5a283d557a4c3980a1281ba.zip |
Merge pull request #576 from kevinthegreat1/tooltip-error-spam-fix
Fix chat spam
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java index fbef1bcb..1b3f402d 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java @@ -249,7 +249,7 @@ public class ItemTooltip { public static void nullWarning() { if (!sentNullWarning && client.player != null) { - client.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.itemTooltip.nullMessage")), false); + LOGGER.warn(Constants.PREFIX.get().append(Text.translatable("skyblocker.itemTooltip.nullMessage")).getString()); sentNullWarning = true; } } @@ -355,15 +355,19 @@ public class ItemTooltip { // If these options is true beforehand, the client will get first data of these options while loading. // After then, it will only fetch the data if it is on Skyblock. - public static int minute = -1; + public static int minute = 0; public static void init() { Scheduler.INSTANCE.scheduleCyclic(() -> { - if (!Utils.isOnSkyblock() && 0 < minute++) { + if (!Utils.isOnSkyblock() && 0 < minute) { sentNullWarning = false; return; } + if (++minute % 60 == 0) { + sentNullWarning = false; + } + List<CompletableFuture<Void>> futureList = new ArrayList<>(); TooltipInfoType.NPC.downloadIfEnabled(futureList); @@ -387,9 +391,10 @@ public class ItemTooltip { TooltipInfoType.MUSEUM.downloadIfEnabled(futureList); TooltipInfoType.COLOR.downloadIfEnabled(futureList); - minute++; - CompletableFuture.allOf(futureList.toArray(CompletableFuture[]::new)) - .whenComplete((unused, throwable) -> sentNullWarning = false); + CompletableFuture.allOf(futureList.toArray(CompletableFuture[]::new)).exceptionally(e -> { + LOGGER.error("Encountered unknown error while downloading tooltip data", e); + return null; + }); }, 1200, true); } }
\ No newline at end of file |