Jump to content

[1.6.2] ServerChatEvent


kdx7214
 Share

Recommended Posts

I'm currently updating my mod from 1.5.2 and one of the features it provides is nickname support in chat.  In the past I had setup a listener for ServerChatEvents and did the substitution there by changing the "line" member.  Now in 1.6.2 the "line" member is no longer present and after quite a bit of digging I've yet to find a way to modify the message before it gets sent to the players.  Not sure if I'm missing something obvious or if I'm just approaching this the wrong way entirely.  Any ideas?

 

Link to comment
Share on other sites

What diesieben07 said should work, but i already had this written out so i figured i might as well as post it.

 

I had a problem similar to this a couple of days ago, and i got around it by making an access transformer that changed the username in the ServerChatEvent to be not final. (This tutorial is a little confusing in the middle, but it helps: http://www.minecraftforge.net/wiki/Using_Access_Transformers )

 

That worked pretty well.

 

I would however recommend using diesieben07's way if it it works for you as this way is a little more complicated and probably shouldn't be used unless absolutely necessary...

-d4rkfly3r

Link to comment
Share on other sites

@diesieben07

To be honest, i thought the same thing at first, but it works fine for me, though when i get home from work, i am going to try it your way, because it makes everything a lot easier.

I don't what it should change if you change those... They are never ever accessed from anywhere. Just passed in once through the constructor.
Link to comment
Share on other sites

I screwed up, i was looking at my old code, what i actually ended up doing was listening for when the client recived the chat and the i edited the message then, cancelled the event, then called it again with my custom message.

 

But i dont recommend using this way

 

-d4rkfly3r

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

 Share



×
×
  • Create New...

Important Information

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