If arguments are neither problem

Discussion in 'Plugin Development' started by Condolent, Jul 16, 2015.

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

    Condolent

    So I have a command with 2 arguments.
    Now I want to check if the 2nd argument typed is neither of the ones I have specified in code, it would say "wrong argument". So this was my solution:
    Code:
                        if(!args[1].equalsIgnoreCase("admin") || !args[1].equalsIgnoreCase("vip") || !args[1].equalsIgnoreCase("elite")) {
                            p.sendMessage(ChatColor.RED + "Group " + args[1] + " does not exist.");
                        }
    Problem is that if I'm typing admin as a 2nd argument, it's not vip or elite so it gives me the error message because of the || I use. Can someone please help me with a better solution??
     
  2. Offline

    Gater12

  3. Offline

    teej107

    @Condolent &&
    This is basic Java. You should learn it before writing Bukkit plugins.
     
  4. Use && instead. If it's NOT admin and NOT vip and NOT elite the group doesn't exist
     
  5. Offline

    Condolent

    I thought && would make it worse? might just be too tired to think straight
     
Thread Status:
Not open for further replies.

Share This Page