Solved Checking for multiple commands?

Discussion in 'Plugin Development' started by klosjaarrr, Jun 7, 2014.

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

    klosjaarrr

    Hey all,

    I'm writing a small plugin with 2 commands, being /title and /titles. Now I need to check if the command is executed, but the following code does not work:

    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    2.  
    3. if (!cmd.getName().equalsIgnoreCase("title") || !cmd.getName().equalsIgnoreCase("titles")) {
    4. // Sending error
    5. return false;
    6. }
    7.  
    8. // Executing code
    9. return true;
    10. }


    Is there a way to check for 2 commands in 1 onCommand() method? Or how would I be able to do this?
     
  2. Offline

    sirantony

    There is an option in the plugin.yml called aliasses, use that. Then set-up a seperate commandExecutor for the command 'title', and set an alias 'titles'.
     
    klosjaarrr likes this.
  3. Offline

    klosjaarrr


    That works, thanks :)
     
Thread Status:
Not open for further replies.

Share This Page