Multiple meanings same command

Discussion in 'Plugin Development' started by Samthelord1, Jul 28, 2013.

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

    Samthelord1

    Hey. I'm soon going to start working on my next project, as soon as I get back from my holiday, and to make it better, I thought I'd do a bit of planning, so I've started the base of the plugin, and I'm wondering if its possible to use my main class, to listen for commands that execute different classes, I know this, but I'm wondering if its possible for say.. Class Swag to have command then you can do: yes or no, and then on a different command it launches a different executor and that executor does something else but still has the options of yes or no, but the two yes' will have different "effects"
     
  2. Offline

    metalhedd

    of course it's possible. you can do anything you want when a command is typed. including storing some value and looking it up next time they type that command.
     
    Samthelord1 likes this.
  3. Offline

    Samthelord1

    Thanks, after posting I thought; hang on... The plugin will be checking if something is typed first it will add starting ground... Of course it's possible
     
  4. Offline

    syszee

    If you are suggesting like having multiple commands (/commandone, /commandtwo, /commandthree), then yes! It is possible! :)

    If you are talking about having something like this: /command <yes|no> , it is also possible. You basically just check to see if the specified argument matches anything, and if it does.. do something!

    Code:java
    1. //Say you have a command /test. These would allow /test yes|no
    2. //(argument tree) /command arg0 arg1 arg2 arg3 ...
    3.  
    4. if(args[0].equalsIgnoreCase("yes"){
    5. //Do something
    6. }
    7.  
    8. if(args[0].equalsIgnoreCase("no"){
    9. //Do something else
    10. }
     
Thread Status:
Not open for further replies.

Share This Page