From 0850dc6a0195d7e52cea13cc5838e75d216f81b7 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Sun, 7 Apr 2024 18:39:07 +1000 Subject: Backend: Change stuff around with chat messages (#1227) --- .../java/at/hannibal2/skyhanni/data/ChatManager.kt | 32 +--------------------- .../at/hannibal2/skyhanni/data/repo/RepoManager.kt | 4 +-- 2 files changed, 2 insertions(+), 34 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/data') diff --git a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt index 8573a629f..40ef1399a 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt @@ -16,7 +16,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.client.Minecraft import net.minecraft.client.gui.ChatLine import net.minecraft.client.gui.GuiNewChat -import net.minecraft.event.HoverEvent import net.minecraft.network.play.client.C01PacketChatMessage import net.minecraft.util.ChatComponentText import net.minecraft.util.EnumChatFormatting @@ -124,9 +123,7 @@ object ChatManager { } val key = IdentityCharacteristics(original) val chatEvent = LorenzChatEvent(message, original) - if (!isSoopyMessage(event.message)) { - chatEvent.postAndCatch() - } + chatEvent.postAndCatch() val blockReason = chatEvent.blockedReason.uppercase() if (blockReason != "") { @@ -161,33 +158,6 @@ object ChatManager { } } - private fun isSoopyMessage(message: IChatComponent): Boolean { - for (sibling in message.siblings) { - if (isSoopyMessage(sibling)) return true - } - - val style = message.chatStyle ?: return false - val hoverEvent = style.chatHoverEvent ?: return false - if (hoverEvent.action != HoverEvent.Action.SHOW_TEXT) return false - val text = hoverEvent.value?.formattedText ?: return false - - val lines = text.split("\n") - if (lines.isEmpty()) return false - - val last = lines.last() - if (last.startsWith("§f§lCOMMON")) return true - if (last.startsWith("§a§lUNCOMMON")) return true - if (last.startsWith("§9§lRARE")) return true - if (last.startsWith("§5§lEPIC")) return true - if (last.startsWith("§6§lLEGENDARY")) return true - if (last.startsWith("§d§lMYTHIC")) return true - if (last.startsWith("§c§lSPECIAL")) return true - - // TODO confirm this format is correct - if (last.startsWith("§c§lVERY SPECIAL")) return true - return false - } - fun openChatFilterGUI(args: Array) { SkyHanniMod.screenToOpen = if (args.isEmpty()) { ChatFilterGui(getRecentMessageHistory()) diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt index 4a42001df..fc024a4c8 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt @@ -7,7 +7,6 @@ import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import com.google.gson.JsonObject import net.minecraft.client.Minecraft @@ -233,8 +232,7 @@ class RepoManager(private val configLocation: File) { return } ChatUtils.chat("Repo has errors! Commit has: ${latestRepoCommit ?: "null"}", prefixColor = "§c") -// if (successfulConstants.isNotEmpty()) ChatUtils.chat( - if (successfulConstants.isNotEmpty()) LorenzUtils.chat( + if (successfulConstants.isNotEmpty()) ChatUtils.chat( "Successful Constants §7(${successfulConstants.size}):", prefixColor = "§a" ) -- cgit