Solved Feed and Heal commands (in plugin) not working!

Discussion in 'Spigot Plugin Help' started by LucidGB, Jun 6, 2017.

  1. This is my code and my output whenever I type /heal or /feed it just returns the command anyone got any ideas of what Ive done wrong?
    upload_2017-6-6_22-25-1.png upload_2017-6-6_22-24-37.png
  2. Instead of




    Instead of

    pm.registerEvents(new PlayerListener(this), this)


    pm.registerEvents(this, this)

    Get rid of public static main instance and public static main getInstance.
    Also make an if statement to check if the sender is a player:

    if(sender.instanceOf(Player)) {
    Player player = (Player) sender;
  3. I had an issue related to this, they told me that I was missing a "return false;" or was suppose to put "return true;" instead of "return false;"

    However, check your plugin.yml and remove any "aliases" fields, that was my plugins issue
  4. Thank you I will attempt to change my code tonight
  5. Hey thank you but may I ask what's an alias? I'll show you my plugin.yml tonight if that's okay :)
  6. Hey thank you but may I ask what's an alias? I'll show you my plugin.yml tonight if that's okay :)
  7. It'd be in your commands part of the plugin.yml like:
    description: Kills you
    aliases: [heals, healing]

    Which was my issue, try changing the commands part of your command code to return true or false to debug (I don't know the real error, im a coding noob)
  8. You must add comand in plugin.yml and register command
    Code (Text):
    • Like Like x 1
  9. I thought you only had to do that if you registered the command in another class...
  10. No, it's in the main class. No need for another instance of JavaPlugin.
  11. Hey sorry, do you have any ideas what the issue may be?
  12. Hey, my first Player has an error saying its not a known variable in the code:
    if(sender.instanceOf(Player)) {
    Player player = (Player) sender;
    this is nesting all of my commands is that correct?
  13. Uh no do not use the label...
  14. Thanks all, it was working fine with a few extra commands too but ive ran into a new issue theyll be a new thread soon