Solved When and when shouldn't I use return true and false?

Discussion in 'Plugin Development' started by DominicGamesHD, Jun 5, 2016.

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

    DominicGamesHD

    When and when shouldn't I use return true and false?
     
  2. Offline

    Xerox262

    @DominicGamesHD In a method that returns a boolean? Or are you asking more specifically for something like when you should return true, and when you should return false?
     
  3. Offline

    DominicGamesHD

    Boolean
     
    A5H73Y likes this.
  4. Offline

    Xerox262

    @DominicGamesHD Do you mean when should you return false in a command and when you should return true in a command? Or something else?
     
  5. Offline

    DominicGamesHD

  6. Offline

    Xerox262

    @DominicGamesHD I'm gonna assume you mean command and just explain that.

    Return true when the player done the command correctly, it tells the server and notifies the user that it's all good.
    Return false if the player made a mistake at all in the command, e.g. forgot arguments, spelt something incorrectly, etc. The command will then tell the server it was not completed correctly and show the user the usage of how to do the command correctly.

    You can return true and handle your own usage/permission messages, however there's no point reinventing the wheel.
     
  7. Offline

    DominicGamesHD

    @Xerox262 Thanks you have been a big help :p :p
     
Thread Status:
Not open for further replies.

Share This Page