aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt
index 34e4354dd..08bef76ff 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt
@@ -17,6 +17,7 @@ import net.minecraft.client.gui.GuiNewChat
import net.minecraft.event.HoverEvent
import net.minecraft.network.play.client.C01PacketChatMessage
import net.minecraft.network.play.server.S02PacketChat
+import net.minecraft.util.ChatComponentText
import net.minecraft.util.EnumChatFormatting
import net.minecraft.util.IChatComponent
import net.minecraftforge.client.event.ClientChatReceivedEvent
@@ -46,6 +47,8 @@ object ChatManager {
RETRACTED(EnumChatFormatting.DARK_PURPLE.toString() + EnumChatFormatting.BOLD),
MODIFIED(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD),
ALLOWED(EnumChatFormatting.GREEN),
+ OUTGOING(EnumChatFormatting.BLUE),
+ OUTGOING_BLOCKED(EnumChatFormatting.BLUE.toString() + EnumChatFormatting.BOLD),
;
val renderedString = "$format$name"
@@ -82,7 +85,14 @@ object ChatManager {
val packet = event.packet as? C01PacketChatMessage ?: return
val message = packet.message
- event.isCanceled = MessageSendToServerEvent(message).postAndCatch()
+ val component = ChatComponentText(message)
+ messageHistory[IdentityCharacteristics(component)] =
+ MessageFilteringResult(component, ActionKind.OUTGOING, null, null)
+ if (MessageSendToServerEvent(message).postAndCatch()) {
+ event.isCanceled = true
+ messageHistory[IdentityCharacteristics(component)] =
+ MessageFilteringResult(component, ActionKind.OUTGOING_BLOCKED, null, null)
+ }
}
@SubscribeEvent(receiveCanceled = true)