Solved Multiple commands in one plugin?

Discussion in 'Plugin Development' started by samyounes03, Mar 14, 2015.

Thread Status:
Not open for further replies.
  1. @samyounes03 The code is wrong. You should use else if not if.
     
    Last edited: Mar 15, 2015
  2. Offline

    Ruptur

    @bwfcwalshy
    *The code is wrong

    Its not wrong since it returns out from the previous if

    Code:java
    1.  
    2. // Boolean expression true or false
    3. if (cmd.getName().equalsIgnoreCase("hello")) {
    4. // if true it will do this ..
    5. player.sendMessage(ChatColor.AQUA + "Hello, " + player.getName() + "!");
    6. return true; // It will stop here and not do anything else
    7. }
    8. if (cmd.getName().equalsIgnoreCase("anothercommand")) {
    9. // Do something else
    10. }
    11. [/
     
  3. Offline

    samyounes03

    I tried the way of Ruptur, and it is the right one, but I have another question, and it will be in a new thread because it has nothing related to this one. Thanks for the help!
     
  4. Offline

    Kilorbine

    Theoricly, it's not false.
    It just more...
    A little bit more time conssuming x)
     
  5. Offline

    nverdier

    @Kilorbine Yeahhh... No. The difference is so 'micro' it honestly doesn't matter. When choosing between returning or using an else statement, just choose the one that's more readable, and of course still logically works.
     
Thread Status:
Not open for further replies.

Share This Page