Anyone Know How To Stop All Incoming Chats On A Player

Discussion in 'Plugin Development' started by LexLaiden, Jul 19, 2012.

Thread Status:
Not open for further replies.
  1. Offline


    How can you stop all incoming chats from displaying on a spacific Players chat window?

    I don't want to mute everyone, I still want them to chat as normal. I only want to know how to stop any chats from being sent to one player only.
  2. Offline


    Listen for the PlayerChatEvent, than check if the player is the player you want to block, if it is, cancel the event, else, don't cancel it:)
  3. Offline


    The Player involved in this event is the player sending the message.
    That would mute the player. I don't want to mute him I want to stop all incoming to him.
  4. Offline


    Oh that way, ehm that's a different story:p
    You than should get all the online players, loop through them, and send all these players the message except for the player that you don't want to let the message see.
  5. Offline


    LexLaiden Use the PlayerChatEvent at highest priority, cancel it and send the message from it manually to all players except the one.
  6. Offline


    hmm, i wonder if its possible to hook into the sendMessage method to a player...

    that would be fun :3
    LucasEmanuel likes this.
  7. Offline


    OK I got it. blackwolf12333 you were in the right direction. Use the PlayerChatEvent and get the set of recipients and remove Player from that set. Don't cancel event.
  8. Offline


    ok, i didn't know you could set the recipients:p but you could also cancel the event and get the message, after that you had to send the message manually...
  9. Offline


    IMO it's much easier to just remove the player from the recipients list.
    ferrybig likes this.
  10. Offline


    it would be..

    Though if youre working with with a channel system, it would be best to just cancel the event, and pass it into the class that handles the chat channels.
  11. Offline


    You can also use the conversations API if you want to block all chat such that the player can 'talk' with your plugin without any commands.
  12. Offline


    dont cancel the chat event, it will break al the plugins who monitors chat
    McLuke500 and ZeusAllMighty11 like this.
  13. Offline


    Not necessarily, remember, events gets passed to _ALL_ plugins no matter if its canceled or not. Thats why we have the priority system so that a plugin can catch the event at the last stop before it gets executed or before the rest of the plugins.

    A plugin can always uncancel a canceled event :)
  14. Offline


    I was talking about plguin that monitors chat, mostly plugins cancel these events if its spam or something else, if you cancel it, it wont show up on plugins that monitor chat
  15. Offline


    Depends if the monitoring plugin listens to canceled events or not. But a chat monitor that logs canceled events is a bad monitor ;)
  16. Offline


    LucasEmanuel ferrybig CorrieKay blackwolf12333 Njol V10lator jamietech
    Thanks for your feedback

    OK I went with my first responce (to used the getRecipients() to get a Set and just remove the one(s) I wanted to and you do not cancel the event. This works perfect and I have added it to my VariableTriggers as a script command
    @QUIET [PlayerName] [Seconds]

    I just uploaded an update with this in it along with the addition of Area triggers. Once the Dev Team aproves you can get the newest v1.1.2
  17. Offline


    Yeah that's happened to my mcstats plugin because a different plugin cancels chat then resends it and my plugin only counts the chat if the event isn't cancelled so I will have to change it.
Thread Status:
Not open for further replies.

Share This Page