Issue with arg[0]

Discussion in 'Plugin Development' started by CRAZYxMUNK3Y, Mar 31, 2012.

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

    CRAZYxMUNK3Y

    Start with, sorry for a possible noob question.

    I have been working on my plugin lately and i have been having some issues with the commands.

    I am working on a command that would be /drop <Block>. It will contain 3 possible arguments as Block.

    What would be the best way to do it?

    Set one class just for /drop <arg> , and another for /destroy <Block> or;

    Create a class for each command and regsister it in the onEnable as

    getCommand("drop <block>").setExecutor("class variable");

    Thanks
     
  2. Offline

    theguynextdoor

    getCommand("drop ").setExecutor(new DropCommand());
    getCommand("break").setExecutor(new BreakCommand());

    So each command has its own executor.

    And then in those classes, you listen on the args and args[0] will be the <Block> argument
     
  3. Offline

    CRAZYxMUNK3Y

    Sorry for the late reply, was working on the code.

    I have finished it (almost), but when i type /drop it only came up with what was defined in the plugin.yml . I tried adding;

    return true;

    after each command, but now it shows nothing.

    Also, whether i have return true or not, nothing shows when i type /drop <block>

    The code for it is here.

    How can this be fixed?

    Thanks
     
  4. Offline

    Darkman2412

    You switched drop and destroy in your code :p
    And, you should remove the 'extends CustomDrops' and 'Listener,' because it doesn't make much sense.. ')
     
Thread Status:
Not open for further replies.

Share This Page