package me.justramon.ircbot.justabotx.commands;

import me.justramon.ircbot.justabotx.config.ConfigHandler;
import me.justramon.ircbot.justabotx.core.Core;
import me.justramon.ircbot.justabotx.core.ICommand;
import me.justramon.ircbot.justabotx.util.MessageHandler;
import me.justramon.ircbot.justabotx.util.StringUtils;
import org.pircbotx.hooks.events.MessageEvent;

public class Operator implements ICommand<MessageEvent> {

    @Override
    public void exe(MessageEvent event, String[] args) throws Exception {
        if (args.length == 0) {
            MessageHandler.respond(event, "Not a valid first argument, valid options are [List/Add/Remove]");
            return;
        }

        String cmd = args[0].toLowerCase();
        switch (cmd) {
            case "list":
                MessageHandler.respond(event, "[" + StringUtils.listToString(ConfigHandler.config.operators) + "]");
                break;

            case "add":
                for (int i = 1; i < args.length; i++) {
                    if (args[i].isEmpty())
                        continue;

                    ConfigHandler.config.operators.add(args[i]);
                }

                ConfigHandler.save();
                String addedPeople = StringUtils.arrayToString(StringUtils.trimArgrumentsFromCommand(args));
                MessageHandler.respond(event, "Added [" + addedPeople + "]");
                break;

            case "remove":
                for (int i = 1; i < args.length; i++) {
                    if (args[i].isEmpty())
                        continue;

                    ConfigHandler.config.operators.remove(args[i]);
                }

                ConfigHandler.save();

                String removedPeople = StringUtils.arrayToString(StringUtils.trimArgrumentsFromCommand(args));
                MessageHandler.respond(event, "Removed [" + removedPeople + "]");
                break;

            default:
                MessageHandler.respond(event, "Not a valid first argument, valid options are [List/Add/Remove]");
        }
    }

    @Override
    public String[] getAliases() {
        return new String[]{"operator"};
    }

    @Override
    public String getInfo() {
        return "List/Add/Remove bot operators";
    }

    @Override
    public String getUsage() {
        return "?<command> [list/add/remove] <nickname> [nickname ...]";
    }

    @Override
    public boolean xtraFunc() {
        return false;
    }

    @Override
    public boolean isOperatorCommand() {
        return true;
    }
}

@@ -580,35 +580,37 @@
 ond(event, %22
-Not a valid
+Please give a
  first argum
@@ -676,32 +676,168 @@
 urn;%0A        %7D%0A%0A
+        if (args.length %3C 2) %7B%0A            MessageHandler.respond(event, %22Please give a username too!%22);%0A            return;%0A        %7D%0A%0A
         String c
@@ -2468,17 +2468,17 @@
 ommand%3E 
-%5B
+%3C
 list/add
@@ -2484,17 +2484,17 @@
 d/remove
-%5D
+%3E
  %3Cnickna

Change some responses and add another check for command form