Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I miss onChatMessageReceived()... We have a ClientChatReceivedEvent, can we get one server-side?

  • Author

Injected a hook myself to get my mod fully updated, but I still think we need this event added.

  • 1 month later...

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!

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

 

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

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!)

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.