Posted June 28, 20196 yr I was trying to make a mod that cancels any chat that starts with ",chatmod", but when I tried event.setCanceled(true), my client didn't show the message but the clients of other players did show the message. Here's a snippet of my code: @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { String message = event.getMessage().getUnformattedText(); print(message+" (printed)"); if (message.split(" ")[0].contentEquals(",chatmod")) { print("CHATMOD COMMAND"); print("TYPE: "+message.split(" ")[2]); event.setCanceled(true); } } Also, here's the print function I made: void print(String toP) { Minecraft.getMinecraft().player.sendMessage(new TextComponentString(toP)); }; What event could be canceled so that the message wouldn't be sent in the first place? Edited June 28, 20196 yr by goldenfire64 Spelling error
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.