Posted October 2, 20204 yr Hello, im trying to make it so if the message that is sent in chat is == `hi` it will send hi! back. This is what I have managed so far, although im unsure how i can make it only send if the message is == `hi` Originally I tried if(e.message.equals("hi"); However, it is false no matter what I do! The type is IChatComponent I then found out that I can do the following: However, im unsure how i can filter the message so its only true if the message is == `hi` @SubscribeEvent public void onChat(ChatReceivedEvent e) { if(e.message.equals(e.message)) { System.out.println(e.message); mc.Player.sendChatMessage("hi!"); }else { System.out.println(e.type); System.out.println("1"); } } If anyone could help me it would be great as I have been trying to get this to work for around 2 hours. Thanks, Logan
October 2, 20204 yr Author @SubscribeEvent public void onChat(ChatReceivedEvent e) { String raw = e.message.getUnformattedText(); if (raw.contains("!help")) { mc.Player.sendChatMessage("hi"); } } I've finally figured it out, next step: How can I make it so if the player sends this message, it will only send it client side?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.