package com.ambientaddons.mixin; import com.ambientaddons.events.GuiContainerEvent; import com.ambientaddons.events.MessageSentEvent; import net.minecraft.client.gui.GuiScreen; import net.minecraftforge.common.MinecraftForge; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(GuiScreen.class) public abstract class MixinGuiScreen { @Inject(method = "sendChatMessage(Ljava/lang/String;)V", at = @At("HEAD"), cancellable = true) public void sendChatMessage(String msg, CallbackInfo ci) { if (MinecraftForge.EVENT_BUS.post(new MessageSentEvent(msg))) { ci.cancel(); } } }