From 3335006b3763fd19bbf15dcd350cbce178d25a07 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 1 Nov 2023 10:47:24 +0100 Subject: code cleanup and minor fixes --- .../features/chat/CompactSplashPotionMessage.kt | 23 ++++++++-------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/chat') 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 d9732079f..c823d83f0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CompactSplashPotionMessage { - private val config get() = SkyHanniMod.feature.chat + private val config get() = SkyHanniMod.feature.chat.compactPotionMessages private val potionEffectPattern = "§a§lBUFF! §fYou have gained §r(?.*)§r§f! Press TAB or type /effects to view your active effects!".toPattern() @@ -19,40 +19,33 @@ class CompactSplashPotionMessage { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.inSkyBlock || !config.compactPotionMessage) return + if (!LorenzUtils.inSkyBlock || !config.enabled) return potionEffectPattern.matchMatcher(event.message) { val name = group("name") sendMessage("§a§lPotion Effect! §r$name") - event.blockedReason = "blocked" + event.blockedReason = "compact_potion_effect" } potionSplashEffectOthersPattern.matchMatcher(event.message) { val playerName = group("playerName").removeColor() val effectName = group("effectName") - sendMessage( - "§a§lPotion Effect! §r$effectName by §b$playerName", - ) - event.blockedReason = "blocked" + sendMessage("§a§lPotion Effect! §r$effectName by §b$playerName") + event.blockedReason = "compact_potion_effect" } potionSplashEffectPattern.matchMatcher(event.message) { val name = group("name") sendMessage("§a§lPotion Effect! §r$name") - event.blockedReason = "blocked" + event.blockedReason = "compact_potion_effect" } } private fun sendMessage(message: String) { - if (config.compactPotionClickableMessage) { - LorenzUtils.hoverableChat( - message, - listOf("§eClick to view your potion effects."), - "/effects" - ) + if (config.clickableChatMessage) { + LorenzUtils.hoverableChat(message, listOf("§eClick to view your potion effects."), "/effects") } else { LorenzUtils.chat(message) - } } } -- cgit