Command not working

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

  1. Why does this command not work? Any Ideas? Please help me.
    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:
    But only if I run it from console...
  4. Use:
    Code (Text):
    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.