diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-04-04 04:56:02 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-03 19:56:02 +0200 |
commit | 1d051f3e1e35489989ca109f1493154641c23068 (patch) | |
tree | a3df2f70828ce87f487f43d6956718ab4c261838 /src/main/java/at/hannibal2/skyhanni/features/itemabilities | |
parent | 14980034dd0fb71973e15c40e1a8a6f4eaa29895 (diff) | |
download | skyhanni-1d051f3e1e35489989ca109f1493154641c23068.tar.gz skyhanni-1d051f3e1e35489989ca109f1493154641c23068.tar.bz2 skyhanni-1d051f3e1e35489989ca109f1493154641c23068.zip |
Fix: Tick event being called twice a tick (#1342)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/itemabilities')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt index 88a44640a..8c6ff9029 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt @@ -7,8 +7,9 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.utils.InventoryUtils -import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeUtils.format @@ -22,13 +23,14 @@ class ChickenHeadTimer { private var lastTime = SimpleTimeMark.farPast() private val cooldown = 5.seconds + private val chickenHead = "CHICKEN_HEAD".asInternalName() + @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return if (!event.isMod(5)) return - val name = InventoryUtils.getHelmet()?.name ?: "" - hasChickenHead = name.contains("Chicken Head") + hasChickenHead = InventoryUtils.getHelmet()?.getInternalName() == chickenHead } @SubscribeEvent |