aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt50
3 files changed, 52 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 91d0e6f46..cc0711452 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -13,10 +13,7 @@ import at.hannibal2.skyhanni.features.bazaar.BazaarBestSellMethod
import at.hannibal2.skyhanni.features.bazaar.BazaarCancelledBuyOrderClipboard
import at.hannibal2.skyhanni.features.bazaar.BazaarOrderHelper
import at.hannibal2.skyhanni.features.bingo.*
-import at.hannibal2.skyhanni.features.chat.ArachneChatMessageHider
-import at.hannibal2.skyhanni.features.chat.ChatFilter
-import at.hannibal2.skyhanni.features.chat.CompactBestiaryChatMessage
-import at.hannibal2.skyhanni.features.chat.PlayerDeathMessages
+import at.hannibal2.skyhanni.features.chat.*
import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFilter
import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatModifier
import at.hannibal2.skyhanni.features.commands.PartyTransferCommand
@@ -375,7 +372,7 @@ class SkyHanniMod {
loadModule(HarpKeybinds())
loadModule(EnderNodeTracker())
loadModule(CompactBestiaryChatMessage())
-
+ loadModule(WatchdogHider())
init()
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 84acf124e..a8733abff 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
@@ -27,7 +27,6 @@ class ChatFilter {
isGuildExp(message) && config.guildExp -> "guild_exp"
friendJoin(message) && config.friendJoinLeft -> "friend_join"
killCombo(message) && config.killCombo -> "kill_combo"
- watchdogAnnouncement(message) && config.watchDog -> "watchdog"
profileJoin(message) && config.profileJoin -> "profile_join"
bazaarAndAHMiniMessages(message) && config.others -> "bz_ah_minis"
@@ -219,14 +218,6 @@ class ChatFilter {
return false
}
- private fun watchdogAnnouncement(message: String) = when {
- message == "§4[WATCHDOG ANNOUNCEMENT]" -> true
- message.matchRegex("§fWatchdog has banned §r§c§l(.*)§r§f players in the last 7 days.") -> true
- message.matchRegex("§fStaff have banned an additional §r§c§l(.*)§r§f in the last 7 days.") -> true
- message == "§cBlacklisted modifications are a bannable offense!" -> true
- else -> false
- }
-
private fun profileJoin(message: String) = when {
message.startsWith("§aYou are playing on profile: §e") -> true
message.startsWith("§8Profile ID: ") -> true
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt
new file mode 100644
index 000000000..60ad41e61
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt
@@ -0,0 +1,50 @@
+package at.hannibal2.skyhanni.features.chat
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.ChatManager
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.ChatLine
+import net.minecraft.util.IChatComponent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.relauncher.ReflectionHelper
+
+class WatchdogHider {
+
+ private var inWatchdog = false
+ private var startLineComponent: IChatComponent? = null
+
+ @SubscribeEvent
+ fun onChatMessage(event: LorenzChatEvent) {
+ if (!LorenzUtils.onHypixel || !SkyHanniMod.feature.chat.watchDog) return
+
+ when (event.message) {
+ watchdogStartLine -> {
+ startLineComponent = event.chatComponent
+ }
+ watchdogAnnouncementLine -> {
+ ChatManager.retractMessage(startLineComponent, "watchdog")
+ startLineComponent = null
+ inWatchdog = true
+ }
+ watchdogEndLine -> {
+ event.blockedReason = "watchdog"
+ inWatchdog = false
+ }
+ }
+
+ if (inWatchdog) {
+ event.blockedReason = "watchdog"
+ }
+ }
+
+ companion object {
+ private const val watchdogStartLine = "§f"
+ private const val watchdogAnnouncementLine = "§4[WATCHDOG ANNOUNCEMENT]"
+ private const val watchdogEndLine = "§c"
+ }
+}
+
+