Hello, everyone.
I'm new to Forge and modding. I decided to try to make a couple of mods.
My first mod is to send a message in the public chat when client sees a certain message in the chat. Some sort of a bot.
So, here is what I got:
@EventHandler
public void onChatRecieved(ClientChatReceivedEvent e){
if (e.message.getUnformattedTextForChat().contains("Bot, hi")){
Minecraft.getMinecraft().thePlayer.sendChatMessage("Troll");
}
}
Full .class
For some reason, this code is not working and I don't know why. When I say "Bot, hi" in the chat, it doesn't send "Troll" in the chat.
Can anyone help me? Will be much appreciated.