From a71f878644e48189b064a59864ee6c32a64bbed8 Mon Sep 17 00:00:00 2001 From: Cow Date: Mon, 10 Oct 2022 23:33:18 +0200 Subject: Removed `ClientChatReceivedEvent` when sending mod-internal chat messages --- CHANGELOG.md | 1 + src/main/java/de/cowtipper/cowlection/util/ChatHelper.java | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f398963..328df89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - `/moo search`: Allow empty search query (= returns all log entries between start and end date) - `/moo stalkskyblock`: replaced "last played" with "last time *someone* played on the selected profile" +- (technical change: no longer fire `ClientChatReceivedEvent` when sending a mod-internal chat message, as too many other mods have had problems with it) ### Fixed diff --git a/src/main/java/de/cowtipper/cowlection/util/ChatHelper.java b/src/main/java/de/cowtipper/cowlection/util/ChatHelper.java index eef9ca7..670f1ee 100644 --- a/src/main/java/de/cowtipper/cowlection/util/ChatHelper.java +++ b/src/main/java/de/cowtipper/cowlection/util/ChatHelper.java @@ -6,7 +6,6 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; -import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -34,11 +33,7 @@ public class ChatHelper { if (Minecraft.getMinecraft().thePlayer == null) { putOfflineMessage(chatComponent); } else { - ClientChatReceivedEvent event = new ClientChatReceivedEvent((byte) 1, chatComponent); - MinecraftForge.EVENT_BUS.post(event); - if (!event.isCanceled()) { - Minecraft.getMinecraft().thePlayer.addChatMessage(event.message); - } + Minecraft.getMinecraft().thePlayer.addChatMessage(chatComponent); } } -- cgit