aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/chat
diff options
context:
space:
mode:
authorDavid Cole <40234707+DavidArthurCole@users.noreply.github.com>2024-10-13 09:54:05 -0400
committerGitHub <noreply@github.com>2024-10-13 15:54:05 +0200
commite0ae2e8ad4602b3e96fb6ec39716709f225d2461 (patch)
treeb70ad5cec46af89dd0f05a61d39027a964c03693 /src/main/java/at/hannibal2/skyhanni/features/chat
parent113389a86c769d4d3a547fac5b7440fa8f29bc6f (diff)
downloadskyhanni-e0ae2e8ad4602b3e96fb6ec39716709f225d2461.tar.gz
skyhanni-e0ae2e8ad4602b3e96fb6ec39716709f225d2461.tar.bz2
skyhanni-e0ae2e8ad4602b3e96fb6ec39716709f225d2461.zip
Backend: Detekt Fixes Part 7 (#2667)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/chat')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/translation/Translator.kt4
4 files changed, 9 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
index 28a2b4b4f..e32769cf6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
@@ -29,6 +29,7 @@ object ChatFilter {
// <editor-fold desc="Regex Patterns & Messages">
// Lobby Messages
+ @Suppress("MaxLineLength")
private val lobbyPatterns = listOf(
// player join
"(?: §b>§c>§a>§r §r)?.* §6(?:joined|(?:spooked|slid) into) the lobby!(?:§r §a<§c<§b<)?".toPattern(),
@@ -159,6 +160,7 @@ object ChatFilter {
)
// Slayer Drop
+ @Suppress("MaxLineLength")
private val slayerDropPatterns = listOf(
// Zombie
"§b§lRARE DROP! §r§7\\(§r§f§r§9Revenant Viscera§r§7\\) (.*)".toPattern(),
@@ -263,6 +265,7 @@ object ChatFilter {
)
// Annoying Spam
+ @Suppress("MaxLineLength")
private val annoyingSpamPatterns = listOf(
"§7Your Implosion hit (.*) for §r§c(.*) §r§7damage.".toPattern(),
"§7Your Molten Wave hit (.*) for §r§c(.*) §r§7damage.".toPattern(),
@@ -520,7 +523,7 @@ object ChatFilter {
* @param message The message to check
* @return The reason why the message was blocked, empty if not blocked
*/
- @Suppress("CyclomaticComplexMethod")
+ @Suppress("CyclomaticComplexMethod", "MaxLineLength")
private fun block(message: String): String? = when {
config.hypixelHub && message.isPresent("lobby") -> "lobby"
config.empty && StringUtils.isEmpty(message) -> "empty"
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt
index 7547ae6ab..745116d16 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt
@@ -15,6 +15,7 @@ object CompactSplashPotionMessage {
private val config get() = SkyHanniMod.feature.chat.compactPotionMessages
+ @Suppress("MaxLineLength")
private val potionEffectPatternList = listOf(
"§a§lBUFF! §fYou were splashed by (?<playerName>.*) §fwith §r(?<effectName>.*)§r§f! Press TAB or type /effects to view your active effects!".toPattern(),
"§a§lBUFF! §fYou have gained §r(?<effectName>.*)§r§f! Press TAB or type /effects to view your active effects!".toPattern(),
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt
index 61658a9de..22db96d30 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt
@@ -64,6 +64,7 @@ object PowderMiningChatFilter {
* REGEX-TEST: §cYou need a tool with a §r§aBreaking Power §r§cof §r§66§r§c to mine Ruby Gemstone Block§r§c! Speak to §r§dFragilis §r§cby the entrance to the Crystal Hollows to learn more!
* REGEX-TEST: §cYou need a tool with a §r§aBreaking Power §r§cof §r§64§r§c to mine Mithril§r§c! Speak to §r§dFragilis §r§cby the entrance to the Crystal Hollows to learn more!
*/
+ @Suppress("MaxLineLength")
private val breakingPowerPattern by patternGroup.pattern(
"warning.breakingpower",
"§cYou need a tool with a §r§aBreaking Power §r§cof (?:§.)*\\d+§r§c to mine .+",
@@ -217,6 +218,7 @@ object PowderMiningChatFilter {
* REGEX-TEST: §r§9Electron Transmitter
* REGEX-TEST: §r§9Superlite Motor
*/
+ @Suppress("MaxLineLength")
private val robotPartsPattern by patternGroup.pattern(
"reward.robotparts",
"§r§9(?:FTX 3070|Synthetic Heart|Control Switch|Robotron Reflector|Electron Transmitter|Superlite Motor)( §r§8x(?<amount>[\\d,]+))?",
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/translation/Translator.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/translation/Translator.kt
index ca827432f..b4e434c1a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/translation/Translator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/translation/Translator.kt
@@ -119,8 +119,8 @@ object Translator {
sourceLanguage: String = "auto",
): Array<String>? {
// TODO add &dj=1 to use named json
- val url = "https://translate.googleapis.com/translate_a/single?client=gtx&dt=t&sl=$sourceLanguage&tl=$targetLanguage&q=" +
- URLEncoder.encode(message, "UTF-8")
+ val encode = URLEncoder.encode(message, "UTF-8")
+ val url = "https://translate.googleapis.com/translate_a/single?client=gtx&dt=t&sl=$sourceLanguage&tl=$targetLanguage&q=$encode"
var messageToSend = ""
val fullResponse = getJSONResponse(url).asJsonArray