@@ -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