diff options
author | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2024-02-26 22:15:22 -0500 |
---|---|---|
committer | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2024-02-26 22:15:22 -0500 |
commit | 6bb1d5a5a7489295949ceba846ca41781beac468 (patch) | |
tree | 272f04733e7b5f3474070eaf93adb7b608fe507c /src/main/java/de | |
parent | ecb507502c3278408571e94095e1f9c24c7b2a40 (diff) | |
download | Skyblocker-6bb1d5a5a7489295949ceba846ca41781beac468.tar.gz Skyblocker-6bb1d5a5a7489295949ceba846ca41781beac468.tar.bz2 Skyblocker-6bb1d5a5a7489295949ceba846ca41781beac468.zip |
Fix chat spam
Diffstat (limited to 'src/main/java/de')
-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 |