I'd like a plugin where when a person does a command, they'll stop receiving chat so no chat comes up. Then once the person does the command again, normal chat will resume for themselves. Need this to work with Permissions & EssentialsChat. this seems like it would be easy EDIT by Moderator: merged posts, please use the edit button instead of double posting.
@Technius I don't think so. That plugin called buycraft disables you from receiving chat when you type /buy. and then to enable it again you type /ec
That involves editing sent packets. And buycraft is how many people? 3? You would need someone more skilled than me to do something like this. And I'm pretty good.
maybe this will work?just a guess first we need to make a List<Player> disabledChat; then on onCommand if(cmd.getname().equalsIgnoreCase("chat")){ if(args[0].equalsIgnoreCase("off")){ disableChat.add((Player)sender); } if(args[0].equalsIgnoreCase("on")){ disableChat.remove((Player)sender) } } then on onPlayerChat for(Player recipients: event.getRecipients){ for(Player disable: disabledChat){ if(recipients.equals(disable)){ event.setCancelled(true); } event.setCancelled(false); } } will this work?im just guessing okay?
Here we go again. event.setCancelled(value) still continues the command chain. And what you're doing is cancelling the sender's chat.
there is no setRecipients it was just a guess...just say no or yes found a solution...hmmm...or maybe someone already found it...i just confirming it if its right...so this will only work by editing sent packets right?wow...this would really need a high ranked java programmer...im going to research more of this as im still learning...but dont hope i will be doing this plugin cause as u can see, im not a plugin developer...im here to learn...xD EDIT by Moderator: merged posts, please use the edit button instead of double posting.
... playerChatEvent if( cancelled) return; ev.getRecipients().removeAll(lists of ppl that have turned it off);
Are you a moron? I don't even care if I get reported for that. event.getRecipients() is a a changeable value where you can apply ANY list function. I don't think I can ever take you seriously again. What? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
You wanted permissions? I didn't make any. EDIT: To be honest. There's no point in limiting the command. Made a new version fixing a few bugs... But you aren't going to get much more out of me. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Buycraft dosent edit any packets, only uses the .GetRecipents() method. Code: // Do not allow the user to speak them selfs if they have disabled their chat if(this.buycraft.disabledChat.containsKey(event.getPlayer())) { event.setCancelled(true); } else { // Loop through each player who has their chat disabled and remove them from the receiving list for(Player player: this.buycraft.disabledChat.keySet()) { event.getRecipients().remove(player); } } } Sorry for bad formatting, its the forum not myself.
@feildmaster does it NOT block "/msg" messages? If it does block them could you make it so that is an exception?