Command not being registered

Discussion in 'Plugin Development' started by 68x, Sep 8, 2011.

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

    68x

    I am 99% sure that I added commands correctly. I have a separate class file that implements the CommandExecutor. This is what I currently have.

    My plugin.yml:
    Code:
    commands:
       idlclear:
          description: Clears the item drops around a specified radius
          permission: itemdroplog.clear
          usage: |
               /<command> [radius]
    
    My onEnable() function has:
    Code:
    getCommand("idlclear").setExecutor(new Commands(this));
    
    This is my onCommand function:
    Code:
        public boolean onCommand(CommandSender cs, Command cmd, String str, String[] strArray)
        {
            Player player = (Player)cs;
    
            if(player.hasPermission("itemdroplog.clear") && cmd.getName().equalsIgnoreCase("idlclear"))
            {
                plugin.log.info(player.getName() + " has cleared some drops!");
    
                return true;
            }
            else
            {
                return false;
            }
        }
    The problem is that I get this error:
    Code:
    Unknown console command, Please type "help" for help!
    
    I am pretty sure that I registered the command; unless I am doing something wrong!
     
  2. Offline

    Sagacious_Zed Bukkit Docs

  3. Offline

    68x

    Guess like BBCode hates me. I had other information in it; guess like I'll re-edit my OP to reflect the changes.
     
  4. Offline

    Sagacious_Zed Bukkit Docs

    Well did you declare your command in the plugin.yml, i still see that as empty.
     
  5. Offline

    68x

    I edited my OP. It should have contained this:
    Code:
    commands:
       idlclear:
          description: Clears the item drops around a specified radius
          permission: itemdroplog.clear
          usage: |
               /<command> [radius]
     
  6. Offline

    Sagacious_Zed Bukkit Docs

    If you don't format your plugin.yml correctly it may break getCommand(). I can't tell from a code snippet.
     
  7. Offline

    68x

    There would a YAML parse error; but there is none.

    Edit:
    There was something wrong with my export.
     
  8. Offline

    Sagacious_Zed Bukkit Docs

    It may not throw an error as it could be proper YAML but for the purposes of the plugin.yml formatted incorecctly.
     
Thread Status:
Not open for further replies.

Share This Page