Posted August 8, 201312 yr 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?
August 8, 201312 yr 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
August 8, 201312 yr @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. -d4rkfly3r
August 8, 201312 yr 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
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.