diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-01-23 16:37:47 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-01-23 16:37:47 +0100 |
commit | 963da98e2f20f142bbb4395a57e8cfbd40c91a8a (patch) | |
tree | 63ba7973a8511af84551d6f7d11a7105386c97ea /src/main | |
parent | 6bd39d3c74563ba3a4abb5ee4b2b3f94e70a2f12 (diff) | |
download | skyhanni-963da98e2f20f142bbb4395a57e8cfbd40c91a8a.tar.gz skyhanni-963da98e2f20f142bbb4395a57e8cfbd40c91a8a.tar.bz2 skyhanni-963da98e2f20f142bbb4395a57e8cfbd40c91a8a.zip |
code cleanup
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt index 29ac6bf3b..eb0fe4a51 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt @@ -34,7 +34,7 @@ object SeaCreatureTracker { private val tracker = SkyHanniTracker("Sea Creature Tracker", { Data() }, { it.fishing.seaCreatureTracker }) { drawDisplay(it) } private val trophyArmorNames by RepoPattern.pattern("fishing.trophyfishing.armor", "(BRONZE|SILVER|GOLD|DIAMOND)_HUNTER_(HELMET|CHESTPLATE|LEGGINGS|BOOTS)") - private var trophyFishingCooldown = SimpleTimeMark.farPast() + private var lastArmorCheck = SimpleTimeMark.farPast() private var isTrophyFishing = false class Data : TrackerData() { @@ -167,17 +167,14 @@ object SeaCreatureTracker { private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled && !isTrophyFishing - private fun isWearingTrophyArmor(): Boolean { - val armorInternalNames = InventoryUtils.getArmor() - return armorInternalNames.all { armorInternal -> - trophyArmorNames.matches(armorInternal?.getInternalName()?.asString().toString()) - } + private fun isWearingTrophyArmor(): Boolean = InventoryUtils.getArmor().all { + trophyArmorNames.matches(it?.getInternalName()?.asString()) } @SubscribeEvent fun onTick (event: LorenzTickEvent) { - if (trophyFishingCooldown.passedSince() < 3.seconds) return - trophyFishingCooldown = SimpleTimeMark.now() + if (lastArmorCheck.passedSince() < 3.seconds) return + lastArmorCheck = SimpleTimeMark.now() isTrophyFishing = isWearingTrophyArmor() } } |