Stop chat from going through to a specific player?

Discussion in 'Plugin Development' started by KaiBB, Feb 15, 2012.

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

    KaiBB

    In a plugin I'm making for somebody, I need to stop chat from coming through to a specific player, and their chat from going to anybody else. I know I can set their chat event to cancelled, but how do I stop other people's messages from coming through?
     
  2. Offline

    Dinnerbone Bukkit Team Member

    For stopping chat going to one player:
    Listen for PlayerChatEvent, then event.getRecipients().remove(player).

    For stopping chat coming from one player:
    Listen for PlayerChatEvent, cancel if event.getPlayer() == player.
     
  3. Offline

    KaiBB

    Thanks for your fast and helpful reply ;)
     
Thread Status:
Not open for further replies.

Share This Page