Skip to content

Commit 5a952cf

Browse files
authored
Fix: Diana since tracker showing 3 times in chat message (#5204)
1 parent 9dbde4d commit 5a952cf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ object MythologicalCreatureTracker {
9898
}
9999

100100
@HandleEvent
101-
fun onChat(event: SkyHanniChatEvent.Modify) {
101+
fun onChatModify(event: SkyHanniChatEvent.Modify) {
102102
if (lastSinceAmount == null) return
103103
val creatureMatch = genericMythologicalSpawnPattern.matchGroups(event.message, "creatureType")?.getOrNull(0) ?: return
104104

@@ -112,8 +112,12 @@ object MythologicalCreatureTracker {
112112
tracker.modify {
113113
for (creatureEntry in DianaApi.mythologicalCreatures.values) {
114114
if (creatureEntry == type) {
115-
val newComp = event.chatComponent.copy().append(" §e($lastSinceAmount)")
116-
event.replaceComponent(newComp, "diana_mobs_since")
115+
if (lastSinceAmount != null) {
116+
val newComp = event.chatComponent.copy().append(" §e($lastSinceAmount)")
117+
event.replaceComponent(newComp, "diana_mobs_since")
118+
}
119+
lastSinceAmount = null
120+
117121
}
118122
}
119123
}

0 commit comments

Comments
 (0)