aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-04-02 06:07:46 +1100
committerGitHub <noreply@github.com>2024-04-01 21:07:46 +0200
commit8b28b68d6956ae406c0b13abece629a197670edf (patch)
tree49ad7909383eecca20cad544535d935177e6feaf /src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt
parent60c5f9c351a7f59622a09cc10a5047c5dca279fa (diff)
downloadskyhanni-8b28b68d6956ae406c0b13abece629a197670edf.tar.gz
skyhanni-8b28b68d6956ae406c0b13abece629a197670edf.tar.bz2
skyhanni-8b28b68d6956ae406c0b13abece629a197670edf.zip
Backend: Less fixed rate timer (#1264)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt b/src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt
new file mode 100644
index 000000000..a0125d35e
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt
@@ -0,0 +1,20 @@
+package at.hannibal2.skyhanni.data
+
+import at.hannibal2.skyhanni.events.SecondPassedEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.client.Minecraft
+import kotlin.concurrent.fixedRateTimer
+
+class FixedRateTimerManager {
+ private var totalSeconds = 0
+
+ init {
+ fixedRateTimer(name = "skyhanni-fixed-rate-timer-manager", period = 1000L) {
+ Minecraft.getMinecraft().addScheduledTask {
+ if (!LorenzUtils.onHypixel) return@addScheduledTask
+ SecondPassedEvent(totalSeconds).postAndCatch()
+ totalSeconds++
+ }
+ }
+ }
+}