net.minecraftforge.client.event.ClientChatReceivedEvent Java Examples
The following examples show how to use
net.minecraftforge.client.event.ClientChatReceivedEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutoReply.java From ForgeHax with MIT License | 7 votes |
@SubscribeEvent public void onClientChat(ClientChatReceivedEvent event) { String message = (event.getMessage().getUnformattedText()); if (message.matches(search.get()) && !message.startsWith(MC.getSession().getUsername())) { String append; switch (mode.get().toUpperCase()) { case "REPLY": append = "/r "; break; case "CHAT": default: append = Strings.EMPTY; break; } getLocalPlayer().sendChatMessage(append + reply.get()); } }
Example #2
Source File: Utils.java From SkyblockAddons with MIT License | 5 votes |
public void sendMessage(String text, boolean prefix) { ClientChatReceivedEvent event = new ClientChatReceivedEvent((byte) 1, new ChatComponentText((prefix ? MESSAGE_PREFIX : "") + text)); MinecraftForge.EVENT_BUS.post(event); // Let other mods pick up the new message if (!event.isCanceled()) { Minecraft.getMinecraft().thePlayer.addChatMessage(event.message); // Just for logs } }
Example #3
Source File: PlayerEventHandler.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent public void onClientChatReceived(ClientChatReceivedEvent event) { ITextComponent message = event.getMessage(); if (Configs.announceLocationBindingInChat == false && message instanceof TextComponentTranslation) { if ("enderutilities.chat.message.itemboundtolocation".equals(((TextComponentTranslation) message).getKey())) { event.setCanceled(true); } } }
Example #4
Source File: Utils.java From SkyblockAddons with MIT License | 4 votes |
public void sendMessage(ChatComponentText text, boolean prefix) { if (prefix) { // Add the prefix in front. ChatComponentText newText = new ChatComponentText(MESSAGE_PREFIX); newText.appendSibling(text); text = newText; } ClientChatReceivedEvent event = new ClientChatReceivedEvent((byte) 1, text); MinecraftForge.EVENT_BUS.post(event); // Let other mods pick up the new message if (!event.isCanceled()) { Minecraft.getMinecraft().thePlayer.addChatMessage(event.message); // Just for logs } }
Example #5
Source File: ObservationFromChatImplementation.java From malmo with MIT License | 4 votes |
@SubscribeEvent public void onEvent(ClientChatReceivedEvent event) { this.chatMessagesReceived.add(new ChatMessage(CHAT_TYPE, event.getMessage().getUnformattedText())); }