Skip to content

Commit 409cf47

Browse files
maybe fix the death chat message detection being wrong idk
i did these changes like last month i dont rememver what they do
1 parent b941c84 commit 409cf47

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/main/kotlin/gg/skytils/skytilsmod/listeners/DungeonListener.kt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ object DungeonListener {
8888
if (!Utils.inDungeons) return
8989
if (event.packet is S02PacketChat) {
9090
val text = event.packet.chatComponent.formattedText
91-
if (event.packet.chatComponent.unformattedText.startsWith("Starting in 1 second.")) {
91+
if (text == "§r§aStarting in 1 second.§r") {
9292
team.clear()
9393
deads.clear()
9494
missingPuzzles.clear()
9595
TickTask(40) {
9696
getMembers()
9797
}
98-
} else if (event.packet.chatComponent.unformattedText.stripControlCodes()
98+
} else if (text.stripControlCodes()
9999
.trim() == "> EXTRA STATS <"
100100
) {
101101
if (Skytils.config.dungeonDeathCounter) {
@@ -149,18 +149,20 @@ object DungeonListener {
149149
TickTask(2, repeats = true) {
150150
if (Utils.inDungeons && (DungeonTimer.scoreShownAt == -1L || System.currentTimeMillis() - DungeonTimer.scoreShownAt < 1500)) {
151151
val tabEntries = TabListUtils.tabEntries
152+
val self = team[mc.thePlayer.name]
152153
for (teammate in team.values) {
153154
if (tabEntries.size <= teammate.tabEntryIndex) continue
154155
val entry = tabEntries[teammate.tabEntryIndex].second
155156
if (!entry.contains(teammate.playerName)) continue
156157
teammate.player = mc.theWorld.playerEntities.find {
157158
it.name == teammate.playerName && it.uniqueID.version() == 4
158159
}
159-
teammate.dead = entry.endsWith("§r§cDEAD§r§f)§r")
160-
if (teammate.dead) {
161-
markDead(teammate)
162-
} else {
163-
deads.remove(teammate)
160+
if (self?.dead != true) {
161+
if (entry.endsWith("§r§cDEAD§r§f)§r")) {
162+
markDead(teammate)
163+
} else if (deads.remove(teammate)) {
164+
teammate.dead = true
165+
}
164166
}
165167
}
166168
}
@@ -174,6 +176,7 @@ object DungeonListener {
174176
// there's no way they die twice in less than half a second
175177
if (lastDeath != null && time - lastDeath <= 500) return
176178
teammate.lastMarkedDead = time
179+
teammate.dead = true
177180
teammate.deaths++
178181
val totalDeaths = team.values.sumOf { it.deaths }
179182
val isFirstDeath = totalDeaths == 1

0 commit comments

Comments
 (0)