New command system help please.

Discussion in 'Plugin Development' started by darknesschaos, Feb 2, 2011.

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

    darknesschaos

    I am asking for assistance as I have no idea how to fix my plugin to work with the new command system.

    anyway, my code is here
     
  2. Offline

    Redecouverte

    the onCommand function goes into your main plugin class (the one that extends JavaPlugin),
    NOT into PlayerListener
     
  3. Offline

    darknesschaos

    that would be an issue!

    fixing.
    --- merged: Feb 2, 2011 9:43 PM ---
    ok, cool. now it works. However, now I get a wall of text saying how to cast picasso every time I type it into the commands is it because I'm returning false?
     
  4. Offline

    Redecouverte

    yes

    return true and it wont display it
     
  5. Offline

    darknesschaos

    thanks!
    --- merged: Feb 2, 2011 10:11 PM ---
    now, for some reason I cannot get the arguments to work... any ideas?
     
  6. Offline

    Redecouverte

    keep in mind that args[] starts with the first argument, and does not contain the command
     
  7. Offline

    darknesschaos

    I know, but for some reason it still does not come up.
     
  8. Offline

    Redecouverte

    did you already change
    if(commandName.compareTo("/picasso") != 0)
    return false;

    to
    if(commandName.compareTo("picasso") != 0)
    return false;
    ?
     
  9. Offline

    darknesschaos

    ok, after getting a println for the contents of /picasso darknesschaos the messages are:
    picasso darknesschaos //command
    [Ljava.lang.String;@33e228bc // when I tell it to print the args
    [Ljava.lang.String;@33e228bc // when I tell it to print the stripped args
    picasso // when i tell it to print the command.

    so apparently args dont work. Can anyone else confirm?
    --- merged: Feb 2, 2011 11:09 PM ---
    @Redecouverte yes.

    code is updated.
     
  10. Offline

    Redecouverte

    args work fine for me

    another thing i noticed:
    for (int j=0; j <= trimmedArgs.length; j++)

    should be.
    for (int j=0; j < trimmedArgs.length; j++)

    also when catching the exception,
    e.printStackTrace();
    will print more details
     
  11. Offline

    darknesschaos

    what is wrong with the args in my case then?
     
  12. Offline

    Redecouverte

    can you post your latest code? :)
    --- merged: Feb 3, 2011 12:01 AM ---
    in your latest git version you are still using
    for (int j=0; j <= trimmedArgs.length; j++)

    but that should be
    for (int j=0; j < trimmedArgs.length; j++)

    also afaik String[].toString() will not list all strings it contains
    --- merged: Feb 3, 2011 12:04 AM ---
    also
    else if (trimmedArgs.length >= 1)
    return false;

    should be removed , debug code?
     
  13. Offline

    darknesschaos

    arg, it does work. I'm just stupid. thanks for all of your help!
     
  14. Offline

    Schirf

    onCommand is only firing when the command entered by the player is exactly the same case as the command defined in the yml file.
     
  15. Offline

    darknesschaos

    I have it working. After working out the kinks, this system makes good sense.
     
Thread Status:
Not open for further replies.

Share This Page