package com.untamedears.civchat;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;

import com.untamedears.citadel.entity.Faction;

/*
 * Coded by Rourke750
 */

public class ChatListener implements Listener {

    private ChatManager chat;

    public ChatListener(ChatManager instance) {
        chat = instance;
    }
    /*
     * TODO: Remove Death messages 
     * TODO: Remove logging messages
     */
    @EventHandler(priority = EventPriority.HIGH)
    public void PlayerChatEvent(AsyncPlayerChatEvent event) {
        event.setCancelled(true);

        String message = event.getMessage();
        Player player = event.getPlayer();
        String channel = chat.getChannel(player.getName());
        Faction group = chat.getGroupTalk(player.getName());

        if (channel != null) {
            Player to = Bukkit.getPlayerExact(channel);
            
            if (to != null) {
                chat.sendPrivateMessage(player, to, message);
                return;
            } 
            else {
                chat.removeChannel(player.getName());
                player.sendMessage(ChatColor.GOLD + "The player you were chatting with has gone offline. You are now in regular chat.");
            }
        }
        if(group!=null){
        	chat.PrivateGroupChat(group, message, player.getName());
        	return;
        }
        chat.sendPlayerBroadcast(player, message, event.getRecipients());
    }
}

@@ -278,16 +278,112 @@
 atEvent;
+%0Aimport org.bukkit.event.player.PlayerJoinEvent;%0Aimport org.bukkit.event.player.PlayerQuitEvent;
 %0A%0Aimport
@@ -621,91 +621,295 @@
     
-/*%0A     * TODO: Remove Death messages %0A     * TODO: Remove logging messages%0A     */
+@EventHandler(priority = EventPriority.HIGH)%0A    public void onPlayerLogin(PlayerJoinEvent event)%7B%0A        event.setJoinMessage(null);%0A    %7D%0A    @EventHandler(priority = EventPriority.HIGH)%0A    public void onPlayerLogout(PlayerQuitEvent event)%7B%0A    %09event.setQuitMessage(null);%0A    %7D%0A   
 %0A   
@@ -1614,11 +1614,10 @@
 lor.
-GOL
+RE
 D + 

Update ChatListener.java