package info.tregmine.commands;

import static org.bukkit.ChatColor.*;

import info.tregmine.Tregmine;
import info.tregmine.api.TregminePlayer;

public abstract class NotifyCommand extends AbstractCommand
{
    public NotifyCommand(Tregmine tregmine, String command)
    {
        super(tregmine, command);
    }

    protected abstract boolean isTarget(TregminePlayer player);

    private String argsToMessage(String[] args)
    {
        StringBuffer buf = new StringBuffer();
        buf.append(args[0]);
        for (int i = 1; i < args.length; ++i) {
            buf.append(" ");
            buf.append(args[i]);
        }

        return buf.toString();
    }

    @Override
    public boolean handlePlayer(TregminePlayer player, String[] args)
    {
        if (args.length == 0) {
            return false;
        }

        String msg = argsToMessage(args);

        // Don't send it twice
        if (!isTarget(player)) {
            player.sendMessage(" + " + player.getChatName() + " " + WHITE + msg);
        }

        for (TregminePlayer to : tregmine.getOnlinePlayers()) {
            if (!isTarget(to)) {
                continue;
            }
            to.sendMessage(" + " + player.getChatName() + " " + WHITE + msg);
        }

        return true;
    }
}

@@ -65,16 +65,46 @@
 lor.*;%0A%0A
+import org.bukkit.ChatColor;%0A%0A
 import i
@@ -841,33 +841,233 @@
 alse;%0A        %7D%0A
+        %0A        ChatColor color;%0A        if (%22admins%22.equalsIgnoreCase(command)) %7B%0A            color = ChatColor.DARK_RED;%0A        %7D else %7B%0A            color = ChatColor.DARK_BLUE;%0A        %7D%0A        
 %0A
-
         String m
@@ -1180,32 +1180,40 @@
 yer.sendMessage(
+color + 
 %22 + %22 + player.g
@@ -1387,32 +1387,32 @@
 ;%0A            %7D%0A
-
             to.s
@@ -1422,16 +1422,24 @@
 Message(
+color + 
 %22 + %22 + 

Update NotifyCommand.java