Posted September 15, 201510 yr I know this is a silly question to ask but is there a way to get the chat right after the players name? I need to check if the players name is in chat and it keeps firing when that user sends a message. Its a client ONLY mod so I cant use any server methods. Also, is there a way to play a sound that overrides the minecraft sound settings and plays even if sound is turned off? Thanks, ~Shaun O'Neill View my website at -> http://www.xelitexirish.com/ You can nearly always contact me on my twitter (XeliteXirish)
September 15, 201510 yr Author Scratch the top one off the list, sorry I managed to figure out how to do it. Just need a way to play a sound overriding the sound settings? View my website at -> http://www.xelitexirish.com/ You can nearly always contact me on my twitter (XeliteXirish)
September 15, 201510 yr Author how about u tell us which version u are in? in 1.7 there is PlaySoundEvent Sorry forgot to mention that haha, its Minecraft 1.8 with newest forge version. View my website at -> http://www.xelitexirish.com/ You can nearly always contact me on my twitter (XeliteXirish)
September 16, 201510 yr I know you may already have the first one solved, but in case others don't know, and would like to know, you can subscribe to the ClientChatReceivedEvent and use regex to separate the player name from the chat. try { if (event.type == 0) { UUID player = null; Pattern p = Pattern.compile("\\<(.*?)\\>"); Matcher m = p.matcher(event.message.getUnformattedText()); while (m.find()) { String s = m.group(1); for (EntityPlayer ep:(List<EntityPlayer>)Minecraft.getMinecraft().theWorld.playerEntities) { if (ep.getName().equals(s)) { player = ep.getUniqueID(); break; } } } if (player != null && event.message.getFormattedText() != null) { String chat = event.message.getFormattedText().replaceFirst("\\<(.*?)\\> ", ""); } } } catch (Exception e) { e.printStackTrace(); }
September 16, 201510 yr Author I know you may already have the first one solved, but in case others don't know, and would like to know, you can subscribe to the ClientChatReceivedEvent and use regex to separate the player name from the chat. try { if (event.type == 0) { UUID player = null; Pattern p = Pattern.compile("\\<(.*?)\\>"); Matcher m = p.matcher(event.message.getUnformattedText()); while (m.find()) { String s = m.group(1); for (EntityPlayer ep:(List<EntityPlayer>)Minecraft.getMinecraft().theWorld.playerEntities) { if (ep.getName().equals(s)) { player = ep.getUniqueID(); break; } } } if (player != null && event.message.getFormattedText() != null) { String chat = event.message.getFormattedText().replaceFirst("\\<(.*?)\\> ", ""); } } } catch (Exception e) { e.printStackTrace(); } Just out of curiosity, can you not just split the chat by every space and just check everything after the first word which is always the player name? Thats what I did and it seems to be okay. View my website at -> http://www.xelitexirish.com/ You can nearly always contact me on my twitter (XeliteXirish)
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.