Plugin Help Channel Chats

Discussion in 'Plugin Help/Development/Requests' started by Declan5486, Oct 31, 2015.

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

    Declan5486

    I have a minigame and i want to have separate chats a spectator chat and a alive chat. I have tried to do this but it did not work in the past.
     
  2. Online

    timtower Administrator Administrator Moderator

    @Declan5486 Did you make the minigame? If so: how are you separating death players from the alive ones?
     
  3. Offline

    Declan5486

    Im using a hashmap of playersAlive
     
  4. Online

    timtower Administrator Administrator Moderator

  5. Offline

    Declan5486

    I do not really understand this page
    I have made a new hashmap because it removes them from playersAlive when they die
    Temporarily i have this for code while i get a spectator chat

    Code:
     @EventHandler
        public void checkSpectatorChat(AsyncPlayerChatEvent e) {
        Player player = e.getPlayer();
        if(playersMap.containsKey(player.getName())){
        if(playersDead.containsKey(player.getName())){
        e.setCancelled(true);   
        player.sendMessage(ChatColor.DARK_RED + "Game" + ChatColor.GRAY + " > " + ChatColor.BLUE + " You cannot talk as you are dead!");
        } else {
        e.setCancelled(false);   
        }}}
     
  6. Online

    timtower Administrator Administrator Moderator

    @Declan5486 Don't cancel the event.
    Use getRecipients to get the list of receivers.
    Remove people from that list who you don't want to get the message.
     
  7. Offline

    Declan5486

    @timtower
    Im getting errors when i try and add it http://prntscr.com/8y9nhc
     
  8. Online

    timtower Administrator Administrator Moderator

  9. Offline

    Declan5486

    Is there anything else i need to add or will the e.getRecipinets plain on its on work ?
     
  10. Online

    timtower Administrator Administrator Moderator

    It returns a list, the players in that list receive the message, change the list.
     
Thread Status:
Not open for further replies.

Share This Page