diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-01-20 23:51:13 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-01-20 23:51:13 +0100 |
commit | 4952ba38c69569bfec7f8afa208d37de9e0f8bba (patch) | |
tree | a8d9dc291782d31f109af852199fb131fb8dde27 /src/main/java/at | |
parent | 3e3ecdc6098e6137574afb925c6fd67551c5bf5c (diff) | |
download | skyhanni-4952ba38c69569bfec7f8afa208d37de9e0f8bba.tar.gz skyhanni-4952ba38c69569bfec7f8afa208d37de9e0f8bba.tar.bz2 skyhanni-4952ba38c69569bfec7f8afa208d37de9e0f8bba.zip |
Added ugly workaround just because
Diffstat (limited to 'src/main/java/at')
4 files changed, 30 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowAPI.kt new file mode 100644 index 000000000..db6de093f --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowAPI.kt @@ -0,0 +1,9 @@ +package at.hannibal2.skyhanni.features.event.diana + +import at.hannibal2.skyhanni.utils.SimpleTimeMark + +object BurrowAPI { + + var lastBurrowRelatedChatMessage = SimpleTimeMark.farPast() + +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt index 5b8776bec..1ab8c0154 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber +import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.renderables.Renderable @@ -104,12 +105,14 @@ object DianaProfitTracker { fun onChat(event: LorenzChatEvent) { val message = event.message if (chatDugOutPattern.matches(message)) { + BurrowAPI.lastBurrowRelatedChatMessage = SimpleTimeMark.now() tracker.modify { it.burrowsDug++ } tryHide(event) } chatDugOutCoinsPattern.matchMatcher(message) { + BurrowAPI.lastBurrowRelatedChatMessage = SimpleTimeMark.now() val coins = group("coins").formatNumber().toInt() tracker.addCoins(coins) tryHide(event) @@ -118,6 +121,7 @@ object DianaProfitTracker { if (message == "§6§lRARE DROP! §r§eYou dug out a §r§9Griffin Feather§r§e!" || message == "§eFollow the arrows to find the §r§6treasure§r§e!" ) { + BurrowAPI.lastBurrowRelatedChatMessage = SimpleTimeMark.now() tryHide(event) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt index 2a468174f..b243f64c7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt @@ -10,8 +10,10 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.features.event.diana.DianaAPI.isDianaSpade import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt +import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeLimitedSet import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.init.Blocks @@ -19,6 +21,7 @@ import net.minecraft.network.play.server.S2APacketParticles import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.minutes +import kotlin.time.Duration.Companion.seconds class GriffinBurrowParticleFinder { private val config get() = SkyHanniMod.feature.event.diana @@ -131,6 +134,7 @@ class GriffinBurrowParticleFinder { if (message.startsWith("§eYou dug out a Griffin Burrow!") || message == "§eYou finished the Griffin burrow chain! §r§7(4/4)" ) { + BurrowAPI.lastBurrowRelatedChatMessage = SimpleTimeMark.now() val burrow = lastDugParticleBurrow if (burrow != null) { if (!tryDig(burrow)) { @@ -138,6 +142,9 @@ class GriffinBurrowParticleFinder { } } } + if (message == "§cDefeat all the burrow defenders in order to dig it!") { + BurrowAPI.lastBurrowRelatedChatMessage = SimpleTimeMark.now() + } } private fun tryDig(location: LorenzVec, ignoreFound: Boolean = false): Boolean { @@ -167,9 +174,16 @@ class GriffinBurrowParticleFinder { return } - if (burrows.containsKey(pos)) { lastDugParticleBurrow = pos + + DelayedRun.runDelayed(1.seconds) { + if (BurrowAPI.lastBurrowRelatedChatMessage.passedSince() > 1.seconds) { + burrows.remove(pos) + LorenzUtils.error("Something unexected happened, deleted the burrow.") + } + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt index f924cefb1..1d2884bc1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut import at.hannibal2.skyhanni.utils.LorenzUtils.sumAllValues import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators +import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker @@ -58,6 +59,7 @@ object MythologicalCreatureTracker { fun onChat(event: LorenzChatEvent) { MythologicalCreatureType.entries.forEach { creatureType -> if (creatureType.pattern.matches(event.message)) { + BurrowAPI.lastBurrowRelatedChatMessage = SimpleTimeMark.now() tracker.modify { it.count.addOrPut(creatureType, 1) } if (config.hideChat) { |