Posted September 5, 201213 yr I miss onChatMessageReceived()... We have a ClientChatReceivedEvent, can we get one server-side?
September 5, 201213 yr Author Injected a hook myself to get my mod fully updated, but I still think we need this event added.
October 12, 201213 yr Hi there, I've been trying to find some what tohandle chat as well. Would you be willing to explain how you injected your own handler? Nothing that I've tried has come close to working. Thanks for your time!
October 13, 201213 yr It's quite simple actually. Create a class that implements IChatListener. public class ChatHandler implements IChatListener { public Packet3Chat serverChat(NetHandler handler, Packet3Chat message) { //handle server chat } public Packet3Chat clientChat(NetHandler handler, Packet3Chat message) { //handle client chat } } Register it like this in your Init method: NetworkRegistry.instance().registerChatListener(new ChatHandler());
October 13, 201213 yr That's a chat listener, not a handler. So, I can modify the result of all chat (i.e., change all bad words to !@#$%^&) but I can't handle who receives the chat message. The chat message goes to everyone. Packet3Chat can't be cancelled either, so the listener must return something. I'm looking for a handler hook, so that I can have complete control over how a chat message is actually delivered. I hope that helps make the destinction... Chronicide
October 13, 201213 yr If you return an empty packet on clientside, it will not show the chat. Protip: try and find answers yourself before asking on the forum. It's pretty likely that there is an answer. Was I helpful? Give me a thank you! http://bit.ly/HZ03zy[/img] Tired of waiting for mods to port to bukkit? use BukkitForge! (now with a working version of WorldEdit!)
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.