How to check splits onCommand?

Discussion in 'Plugin Development' started by lpjz2, Mar 26, 2011.

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

    lpjz2

    i was wondering how to check split properly?

    this is my attempt...
    Code:
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
            if(commandLabel.equalsIgnoreCase("NV")){
                getServer().broadcastMessage(ChatColor.AQUA + "Lpjz2 just Uploaded a New VIDEO!");
             if (args.length == 1){
             if (args[1].equalsIgnoreCase("1")) {
                    getServer().broadcastMessage(ChatColor.RED + "Video is VERY Important, Watch ASAP");
                    return true;
             }
    }
            }
            return false;
        }
    }
    
    it supposta say lpjz2 uploaded a new video when i type /nv

    and it adds Video is VERY Important if i type /nv 1
     
  2. Offline

    Edward Hand

    You haven't told us what your problem is.

    However:
    Code:
     if (args[1].equalsIgnoreCase("1")) {
    should be:
    Code:
     if (args[0].equalsIgnoreCase("1")) {
     
  3. Offline

    lpjz2

    oh sorry,

    when i type /nv it says i uploaded a new video but underneath it says a error or something, but i approached it with no idea on how to tackle it... this is my aim...


    /nv = Broadcast : "Lpjz2 uploaded a new video"
    /nv 1 = same as above + "video is urgent"

    but i have no idea how to add the /nv 1 without making a whole new command, it would be good if i cna figure splits out for practice
     
  4. Offline

    Edward Hand

    Make the change I suggested and it should work fine.
     
Thread Status:
Not open for further replies.

Share This Page