Can't get commands working

Discussion in 'Plugin Development' started by nemakulis, Mar 6, 2011.

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

    nemakulis

    Hello, before I was forced to use onCommand, my commands worked fine, but now I can't get onCommand working.

    Code:
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String args[]) {
            System.out.println("Command requested!");
            if(sender instanceof Player) {
                Player player = (Player)sender;
                String command = cmd.getName().toLowerCase();
                if(command.equals("mycommand")) {
                    if(args.length > 0) {
                        // args passed
                    }
                    else {
                        // no args
                    }
                    return true;
                }
                else {
                    return false;
                }
            }
            return false;
        }
    When in server I type /mycommand, I get
    When I type /mycommand arg, I get
    Also nothing in server console shows up. I think there should be message
    Hope you'll be able to help me!
     
  2. Offline

    Plague

    you have to register the commands in plugin.yml

    just use someone's source code as an example.
     
Thread Status:
Not open for further replies.

Share This Page