Command not working

Discussion in 'Spigot Plugin Development' started by zozidalom, May 27, 2016.

  1. Why does this command not work? http://pastebin.com/yg3TANqC Any Ideas? Please help me.
    Plugin.yml:
    commands:
    ribal:
    permission: risingempire.economy
     
  2. Fairly certain you have to register the command on onEnable(). Did you do that?
     
    • Like Like x 1
  3. I have done it but still nothing...
    Now I get this error: http://pastebin.com/L6mb8mg2
    But only if I run it from console...
     
  4. Use:
    Code (Text):
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
         //Your code goes here
    }
     
  5. Not good in the sam class I already have an other command named onCommand....
     
  6. Your class must implement CommandExecutor, your method name is spelled incorrectly. You blind cast to player, your spacing is inconsistent.

    EDIT: Then make another class with an onCommand method... Don't cram everything into one.
     
  7. You should rename the method 'onCommand2()' to 'onCommand()', because this method is overriding the method of the super class (JavaPlugin).
     
  8. Use different classes for different commands.;)
     
    • Like Like x 1
  9. Add another if-statement that checks if the sender is an instanceof Player. If it's not then just stop the command.
     
    • Like Like x 1
  10. Thank you! I will try it with different Classes.