Solved Command doesn't work.

Discussion in 'Plugin Development' started by jinhoftyu, Aug 20, 2021.

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

    jinhoftyu

    The Main class (extends JavaPlugin)
    Code:
    @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (cmd.getName().equalsIgnoreCase("party")) {
                sender.sendMessage("Hey!");
                return true;
            }
            return false;
        }
    plugin.yml
    Code:
    name: Party
    main: com.overseer.party.Main
    version: 1.0
    api-version: 1.16
    commands:
      party:
        description: "party"
    
    Whenever I recently tried to add command in new project(Making the onCommand method and add commands in plugin.yml), it didn't work. I have no idea why this is not working.
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    StellarFX

    @jinhoftyu Did you register your command in your onEnable()?
     
  4. Offline

    timtower Administrator Administrator Moderator

    Don't need to if it is the class extending JavaPlugin
     
  5. Offline

    jinhoftyu

    Nothing. And also I cannot even see this command in /help nor recommended.

    I (somehow) used other IDE and it worked. But I can't figure out what is wrong. upload_2021-8-20_23-58-36.png
    파티1.PNG
    Intelij didn't worked :(
     
    Last edited by a moderator: Aug 20, 2021
  6. Offline

    timtower Administrator Administrator Moderator

  7. Offline

    jinhoftyu

  8. Offline

    Tim_M

    Did you register the command in plugin.yml? If you didn't it would explain why it didn't appear in the help menu.
     
  9. Offline

    jinhoftyu

    Check the first thread.
     
Thread Status:
Not open for further replies.

Share This Page