From cb58fbc282aad987353a912d3c872de1d8f5534a Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Fri, 23 Sep 2022 21:06:05 +0800 Subject: + Fix potion timer going into the negatives + Make potion timer alert show as a title --- src/features/hud/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/features/hud/index.js b/src/features/hud/index.js index f1cfa33..352a9d0 100644 --- a/src/features/hud/index.js +++ b/src/features/hud/index.js @@ -632,7 +632,7 @@ class Hud extends Feature { godPotTime = this.potsExpireAt["water_breathing"].time } - if (godPotTime > 0) { + if (godPotTime > 0 && godPotTime > Date.now()) { let timeLeft = "" if (godPotTime - Date.now() > 60000 * 60) { timeLeft = timeNumber2(godPotTime - Date.now()) @@ -643,6 +643,7 @@ class Hud extends Feature { if (this.potsOutAlert.getValue() && godPotTime - Date.now() < 60000 && Date.now() - (this.lastPotAlerts["godpot"] || 0) > 2 * 60000) { this.lastPotAlerts["godpot"] = Date.now() + Client.showTitle("&cPotion About to run out", "Your &6God potion&f is about to run out!", 20, 60, 20) ChatLib.chat(this.FeatureManager.messagePrefix + "Your God potion is about to run out!") } } @@ -651,6 +652,7 @@ class Hud extends Feature { let potData = this.potsExpireAt[k] if (potData.infinite) return if (basiclyEqual(potData.time, godPotTime, 1000)) return + if (potData.time < Date.now()) return if (k === "haste" && potData.level === 1) return @@ -658,6 +660,7 @@ class Hud extends Feature { if (this.potsOutAlert.getValue() && potData.time - Date.now() < 60000 && Date.now() - (this.lastPotAlerts[k] || 0) > 2 * 60000) { this.lastPotAlerts[k] = Date.now() + Client.showTitle("&cPotion About to run out", "Your &6" + potName + "&f is about to run out!", 20, 60, 20) ChatLib.chat(this.FeatureManager.messagePrefix + "Your " + potName + " is about to run out!") } -- cgit