All commands being executed at once!

Discussion in 'Plugin Development' started by zachrocks22, Jul 23, 2015.

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

    zachrocks22

    Hello there fellow Bukkit friends... I'm making a plugin called Votey (its super simple)
    But I have been noticing with this plugin (and past updates for older ones I make) that when I do a command, all the commands or a good handfull are executed at once..

    Any ideas or comments saying they face the same problems is very helpful!
     
    Last edited: Jul 24, 2015
  2. Offline

    teej107

  3. Offline

    TheDiamond06

    @teej107 You use

    Code:
    if(commandLabel.equalsIgnoreCase("votey"));{}
    NEVER put a semicolon after your if statement that defeats the purpose
     
  4. Offline

    teej107

    Wrong tahg :p

    @zachrocks22
     
  5. Offline

    raymart23

    @zachrocks22 add return true; example
    Code:
    if(cmd.blabla("vote")) {
      // send a message
      return true;
    }
    return true; stands for finish.
     
  6. Offline

    Hawktasard

    @zachrocks22
    Other than what everybody else here has said, you should also use else if (this wouldn't change much since you're just comparing strings, but every single nanosecond counts, right?)
     
  7. Offline

    zachrocks22

    Thank you all so VERY much! :D

    That fixed the problem ASAP... IM a little new to coding plugins and this confused me FOREVER! This is SO helpful.

    And now my gratitude:

    Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you :) Thank you
     
  8. Offline

    TheDiamond06

    @teej107 Whoops didn't notice who I was tagging :p
     
  9. Offline

    raymart23

    Welcome we really hope that you were solved it
     
  10. Offline

    harvmaster

    Instead of an else if statement you could use a switch like this

    Code:
    switch (commandLabel) {
      
            case "Command1":
                //Do something
            break;
          
            case "Command2":
                //Do something else
            break;
            
            default:
                //Don't do anything
      
        }
     
Thread Status:
Not open for further replies.

Share This Page