Skip to content

Commit bb524c8

Browse files
committed
woopsies?
1 parent 58e6093 commit bb524c8

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

src/main/kotlin/com/github/subat0m1c/hatecheaters/modules/dungeons/ClearSecrets.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ object ClearSecrets : Module(
4949

5050
onMessage(Regex(" {29}> EXTRA STATS <")) { ExtraStatsHandler.waitForOtherMods() }
5151

52-
onMessage(Regex("^\\s*Secrets Found: (\\d+)\$")) {
53-
modMessage("WHATFRICKSECRETS")
54-
ownSecrets = it.groupValues[1].toLongOrNull() ?: 0
55-
}
52+
onMessage(Regex("^\\s*Secrets Found: (\\d+)\$")) { ownSecrets = it.groupValues[1].toLongOrNull() ?: 0 }
5653
}
5754

5855
@SubscribeEvent

src/main/kotlin/com/github/subat0m1c/hatecheaters/utils/ExtraStatsHandler.kt

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,21 @@ object ExtraStatsHandler {
2727
}
2828

2929
@SubscribeEvent
30-
fun onChatMessage(event: ClientChatReceivedEvent) {
30+
fun onChatMessage(event: ClientChatReceivedEvent) = with(event.message.unformattedText) {
3131
if (!DungeonUtils.inDungeons) return
32-
if ((event.message.unformattedText.matches(blank) || formattingRegexes.any { it.matches(event.message.unformattedText.noControlCodes) }) && expectingStats) event.isCanceled = true
33-
if (regexes.none { it.matches(event.message.unformattedText.noControlCodes) }) return
34-
if (expectingStats || hideButDontCheck.any { it.matches(event.message.unformattedText.noControlCodes) }) event.isCanceled = true
32+
if ((hideButDontCheck.any { it.matches(noControlCodes) } || blank.matches(this)) && expectingStats) event.isCanceled = true
33+
if (regexes.none { it.matches(noControlCodes) }) return@with
34+
if (expectingStats) event.isCanceled = true
3535
else receivedStats = true
3636
}
3737

3838
private val blank = Regex("§r")
39-
40-
private val formattingRegexes = listOf(
41-
Regex("^▬+\$"),
42-
Regex("^ {7}$"),
43-
)
44-
45-
/**
46-
* ngl i think this stuff sucks and looks bad but it works and i dont wanna fix
47-
*/
4839
private val hideButDontCheck = listOf(
4940
Regex("^\\s*Team Score: \\d+ \\(.{1,2}\\)\\s?(?:\\(NEW RECORD!\\))?\$"),
5041
Regex("^\\s*☠ Defeated (.+) in 0?([\\dhms ]+?)\\s*(\\(NEW RECORD!\\))?\$"),
5142
Regex("^\\s*Deaths: \\d+\$"),
43+
Regex("^▬+\$"),
44+
Regex("^ {7}$"),
5245
)
5346

5447
private val regexes = listOf(
@@ -59,5 +52,5 @@ object ExtraStatsHandler {
5952
Regex("^\\s*Ally Healing: [\\d,.]+\\s?(?:\\(NEW RECORD!\\))?\$"),
6053
Regex("^\\s*Enemies Killed: \\d+\\s?(?:\\(NEW RECORD!\\))?\$"),
6154
Regex("^\\s*Secrets Found: \\d+\$"),
62-
) + hideButDontCheck
55+
)
6356
}

0 commit comments

Comments
 (0)