Jump to content

NetServerHandler.handleChat event hook please.


volDeus

Recommended Posts

  • 1 month later...

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());

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

 

 

width=635 height=903http://bit.ly/HZ03zy[/img]

 

 

Tired of waiting for mods to port to bukkit?

use BukkitForge! (now with a working version of WorldEdit!)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.