Issue setting up commands

Discussion in 'Plugin Development' started by ferrago, Apr 9, 2014.

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

    ferrago

    I have tried everything I can think to get my commands working. When I slap the onCommand method inside of my main everything works perfect, but when I have the following code, I get no response when using the cmd, no display usage, no info logged, no broadcasted messages, nothing. I have looked through close to a hundred similar issues, and have tried everything to no avail.
    Code:java
    1. public void OnEnable()
    2. {
    3. Bukkit.getServer().getPluginManager().registerEvents(this, this);
    4. CqmCommandHandler commander = new CqmCommandHandler(this);
    5. getCommand("cqm").setExecutor(commander);
    6. }


    Code:java
    1. public class CqmCommandHandler implements CommandExecutor {
    2. private JavaPlugin mainPlugin;
    3. public CqmCommandHandler(JavaPlugin plugin)
    4. {
    5. mainPlugin = plugin;
    6. mainPlugin.getLogger().info("Handling Commands");
    7. }
    8.  
    9. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    10. Bukkit.broadcastMessage("Testing Handler");
    11. return true;
    12. }
    13.  
    14.  
    15. }


    I never see any info in the console, nor do I see the broadcast message, nor am I getting the display usage anymore.

    Here is my yml.

    Code:
    name: ConquestiaMobs
    main: com.conquestia.mobs.ConquestiaMobs
    version: 0.0.1
    author: Ultiferrago
     
    commands:
      cqm:
          description: Controls all Conquestia Mob Commands.
          usage: /<command>
          permission: conquestiamobs.admin
          permission-message: You don't have permission for that command!
          
     
     
    permissions:
      conquestiamobs.admin:
        default: op
    Fixed the issue, it's onEnable() not OnEnable() /fail

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
Thread Status:
Not open for further replies.

Share This Page