bl4ckscor3 Posted January 26, 2014 Share Posted January 26, 2014 Hello! I'm using the ClientChatReceivedEvent to check for specific words in the message, then giving a sound to the player. But I don't want the sound to play, if the current Player writes that specific word. So I need to get the name of the player who sent the message. I already tried the ClientChatReceivedEvent.message.func_150260_c(); method (which returns the message just as you see it in the chat) and then extracting the players name, but that does not work on servers with custom chat formats, since I search for "<" and ">". Is there any way to get the name without searching for specific symbols in the message and extracting them? Thanks in advance ~bl4ck Quote http://i.imgur.com/kPfhwnJ.png[/img] ↑↑↑↑↑↑↑↑↑↑ Click it please? :3 ↑↑↑↑↑↑↑↑↑↑ Link to comment Share on other sites More sharing options...
TheGreyGhost Posted January 26, 2014 Share Posted January 26, 2014 Hi Some ideas to try (1) when a client sends a chat message, it could remember it, and if it receives the identical message within (say) 1 - 2 seconds, it knows that it was almost certainly the sender or (2) you could search the incoming message for each of the player names, discard any which don't match, and pick the best of any that do match (the one with the earliest match position in the string) or (3) write your own "play sound" packet, i.e. the client searches the chat message it is about to send for the specific word, and if it is present, sends a packet to the server which then does "play the sound on all clients except the original client". -TGG Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.