Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 committed May 3, 2024
1 parent ef7fcbf commit 04f23d3
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package at.hannibal2.skyhanni.test.command
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.StringUtils.stripHypixelMessage
import net.minecraft.util.ChatComponentText
import net.minecraft.util.IChatComponent

Expand Down Expand Up @@ -40,16 +40,15 @@ object TestChatCommand {
}

private fun test(componentText: IChatComponent) {
val event = LorenzChatEvent(LorenzUtils.stripVanillaMessage(componentText.formattedText), componentText)
val message = componentText.formattedText.stripHypixelMessage()
val event = LorenzChatEvent(message, componentText)
event.postAndCatch()

if (event.blockedReason != "") {
ChatUtils.chat("§cChat blocked: ${event.blockedReason}")
} else {
val finalMessage = event.chatComponent
if (LorenzUtils.stripVanillaMessage(finalMessage.formattedText) != LorenzUtils.stripVanillaMessage(
componentText.formattedText)
) {
if (finalMessage.formattedText.stripHypixelMessage() != message) {
ChatUtils.chat("§eChat modified!")
}
ChatUtils.chatComponent(finalMessage)
Expand Down

0 comments on commit 04f23d3

Please sign in to comment.