Jump to content

[1.7.10] Changing a simple chat message not so simple...


Recommended Posts

Posted

So, i thought, lets do this. I know how to program but i aint a pro. Lets start with something simple: Remove or change that simple message when the user logs in on the server.

I'm talking about the "User joined the game" and "User left the game" message. Not that 'client side' MOTD message you get when u logon a server. I mean that message that is being broadcasted serverwide to all players. I want to customize that but it seems that the function responsible for that is the initializeConnectionToPlayer() function from the ServerConfigurationManager class. In version (MC 1.7.10) line 157 to 169 to be exactly. It prepares the chatcomponentTranslation and then sends it.

 

In the beginning i stumbled upon those forge events and i instantly started looking up the reference for player login events. With no luck. I read about the ability of cancellation of events so that was really disappointing.  So, my question is.. are we able to remove that message and replace it by my own? And i mean that one on line 169?

 

this.sendChatMsg(chatcomponenttranslation);

 

I just want to be pointed in the right direction. I noticed it is part of an abstract class.

 

Thanks!

 

Posted

Aha, thanks.

 

So basically what your solution does is catching and modifying the (from the server received) message on the client? (correct me if i'm wrong, i'm trying to understand the concept here).

Am i forced to ship my mod to every client then? (I want the mod to be on the server only. Not really a client mod, but if there is no other way..).

 

Edit:

Oh wait a minute. I see ServerChatEvent too. Let's figure that out. Maybe i can catch it before it is even send to the clients. (that would be ideally)

Posted

I understand.

 

Any reason why there is no hook over there? Would be great if modders could get control over that part too by an event. Without Netty the only 'neat' way to do it is create a coremod. Little too deep for me :P.

Posted

Just a thought, but can you change the message in the lang file itself?  It seems that it is using multiplayer.player.joined or something like that.

 

That's right. I also thought about this but then i realized they hardcoded the color of the text.

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.