public CommandManager() { EventManager.register(new Listener<SendChat>() { @Override public void call(SendChat event) { if (event.getMessage().startsWith(".")) { event.setCancelled(true); if (event.getMessage().startsWith("..")) { mc.getNetHandler().getNetworkManager().sendPacket(new C01PacketChatMessage(event.getMessage().substring(1))); return; } if (event.getMessage().length() > 1) executeCommand(CommandSender.CHAT, event.getMessage().substring(1)); } } }); }
@Override public void onUpdate() { if (Minecraft.getMinecraft().thePlayer.getHealth() <= 8.0 && !Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode && (!Minecraft.getMinecraft().isIntegratedServerRunning() || Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfo().size() > 1)) { switch (WurstClient.INSTANCE.options.autoLeaveMode) { case 0: Minecraft.getMinecraft().theWorld.sendQuittingDisconnectingPacket(); break; case 1: Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C01PacketChatMessage("�")); break; default: break; } setEnabled(false); } }
/** * @author serenity.host */ @Overwrite public void sendChatMessage(String message) { SendChat event = EventManager.post(new SendChat(message)); message = event.getMessage(); if (!event.isCancelled()) this.sendQueue.addToSendQueue(new C01PacketChatMessage(message)); }
@Override public void execute(String[] args) throws Error { if (args.length > 0) { String message = args[0]; for (int i = 1; i < args.length; i++) { message += " " + args[i]; } Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C01PacketChatMessage(message)); } else { syntaxError("Message required."); } }
private void disconnectWithMode(int mode) { switch (mode) { case 0: Minecraft.getMinecraft().theWorld.sendQuittingDisconnectingPacket(); break; case 1: Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C01PacketChatMessage("�")); break; default: break; } }
/** * @author jamierocks - 1st September 2016 * @reason Overwrite to pass chat to Canary. */ @Overwrite public void processChatMessage(C01PacketChatMessage packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, (NetHandlerPlayServer) (Object) this, this.playerEntity.getServerForPlayer()); if (this.playerEntity.getChatVisibility() == EntityPlayer.EnumChatVisibility.HIDDEN) { ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("chat.cannotSend"); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); this.sendPacket(new S02PacketChat(chatcomponenttranslation)); return; } this.chatSpamThresholdCount += 20; final boolean op = Canary.ops().isOpped((PlayerReference) this.playerEntity); final boolean ignore = ((Player) this.playerEntity).canIgnoreRestrictions(); final String spamProtectionLevel = Configuration.getServerConfig().getSpamProtectionLevel(); if (spamProtectionLevel.equalsIgnoreCase("all") || (spamProtectionLevel.equalsIgnoreCase("default") && !(op || ignore))) { if (this.chatSpamThresholdCount > 200) { this.kickPlayerFromServer("disconnect.spam"); return; } } this.playerEntity.markPlayerActive(); ((Player) this.playerEntity).chat(packetIn.getMessage()); }
/** * Process chat messages (broadcast back to clients) and commands (executes) */ public void processChatMessage(C01PacketChatMessage packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); if (this.playerEntity.getChatVisibility() == EntityPlayer.EnumChatVisibility.HIDDEN) { ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("chat.cannotSend", new Object[0]); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); this.sendPacket(new S02PacketChat(chatcomponenttranslation)); } else { this.playerEntity.markPlayerActive(); String s = packetIn.getMessage(); s = StringUtils.normalizeSpace(s); for (int i = 0; i < s.length(); ++i) { if (!ChatAllowedCharacters.isAllowedCharacter(s.charAt(i))) { this.kickPlayerFromServer("Illegal characters in chat"); return; } } if (s.startsWith("/")) { this.handleSlashCommand(s); } else { IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.text", new Object[] {this.playerEntity.getDisplayName(), s}); this.serverController.getConfigurationManager().sendChatMsgImpl(ichatcomponent, false); } this.chatSpamThresholdCount += 20; if (this.chatSpamThresholdCount > 200 && !this.serverController.getConfigurationManager().canSendCommands(this.playerEntity.getGameProfile())) { this.kickPlayerFromServer("disconnect.spam"); } } }
/** * Sends a chat message from the player. Args: chatMessage */ public void sendChatMessage(String message) { this.sendQueue.addToSendQueue(new C01PacketChatMessage(message)); }
@Override public void runCommand(String[] args) { Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue((Packet)new C01PacketChatMessage("/testncp input")); Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue((Packet)new C01PacketChatMessage("/testncp input " + args[1])); }
/** * Sends a chat message from the player. Args: chatMessage */ public void sendChatMessage(String message) { if (!Client.getClient().getManagers().getManager(CommandManager.class).processCommand(message)) { this.sendQueue.addToSendQueue(new C01PacketChatMessage(message)); } }
@Override public boolean recieveCommand(String cmd) throws Exception { String args[] = cmd.split("say "); Resilience.getInstance().getInvoker().sendPacket(new C01PacketChatMessage(args[1])); return true; }
/** * Process chat messages (broadcast back to clients) and commands (executes) */ public void processChatMessage(C01PacketChatMessage p_147354_1_) { if (this.playerEntity.func_147096_v() == EntityPlayer.EnumChatVisibility.HIDDEN) { ChatComponentTranslation var4 = new ChatComponentTranslation("chat.cannotSend", new Object[0]); var4.getChatStyle().setColor(EnumChatFormatting.RED); this.sendPacket(new S02PacketChat(var4)); } else { this.playerEntity.func_143004_u(); String var2 = p_147354_1_.func_149439_c(); var2 = StringUtils.normalizeSpace(var2); for (int var3 = 0; var3 < var2.length(); ++var3) { if (!ChatAllowedCharacters.isAllowedCharacter(var2.charAt(var3))) { this.kickPlayerFromServer("Illegal characters in chat"); return; } } if (var2.startsWith("/")) { this.handleSlashCommand(var2); } else { ChatComponentTranslation var5 = new ChatComponentTranslation("chat.type.text", new Object[] {this.playerEntity.func_145748_c_(), var2}); this.serverController.getConfigurationManager().func_148544_a(var5, false); } this.chatSpamThresholdCount += 20; if (this.chatSpamThresholdCount > 200 && !this.serverController.getConfigurationManager().isPlayerOpped(this.playerEntity.getCommandSenderName())) { this.kickPlayerFromServer("disconnect.spam"); } } }
/** * Sends a chat message from the player. Args: chatMessage */ public void sendChatMessage(String par1Str) { this.sendQueue.addToSendQueue(new C01PacketChatMessage(par1Str)); }
@Override public void processChatMessage(C01PacketChatMessage p_147354_1_) { }
public void sendChatMessage(String p_71165_1_) { this.sendQueue.addToSendQueue(new C01PacketChatMessage(p_71165_1_)); }
public void processChatMessage(C01PacketChatMessage p_147354_1_) { if (this.playerEntity.func_147096_v() == EntityPlayer.EnumChatVisibility.HIDDEN) { ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("chat.cannotSend", new Object[0]); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); this.sendPacket(new S02PacketChat(chatcomponenttranslation)); } else { this.playerEntity.func_143004_u(); String s = p_147354_1_.func_149439_c(); s = StringUtils.normalizeSpace(s); for (int i = 0; i < s.length(); ++i) { if (!ChatAllowedCharacters.isAllowedCharacter(s.charAt(i))) { this.kickPlayerFromServer("Illegal characters in chat"); return; } } if (s.startsWith("/")) { this.handleSlashCommand(s); } else { ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", new Object[] {this.playerEntity.func_145748_c_(), s}); chatcomponenttranslation1 = ForgeHooks.onServerChatEvent(this, s, chatcomponenttranslation1); if (chatcomponenttranslation1 == null) return; this.serverController.getConfigurationManager().sendChatMsgImpl(chatcomponenttranslation1, false); } this.chatSpamThresholdCount += 20; if (this.chatSpamThresholdCount > 200 && !this.serverController.getConfigurationManager().func_152596_g(this.playerEntity.getGameProfile())) { this.kickPlayerFromServer("disconnect.spam"); } } }
/** * Process chat messages (broadcast back to clients) and commands (executes) */ void processChatMessage(C01PacketChatMessage packetIn);
/** * Process chat messages (broadcast back to clients) and commands (executes) */ void processChatMessage(C01PacketChatMessage var1);
void processChatMessage(C01PacketChatMessage p_147354_1_);