Solved Commands won't execute after incorporating maven

Discussion in 'Spigot Plugin Development' started by Xurvold, Apr 1, 2020.

  1. As the title says, I incorporated maven but now my commands won't execute.

    Code (Java):

    package me.xurvold.Test;

    import org.bukkit.ChatColor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;

    public class Main extends JavaPlugin {

        public void onEnable() {
            getLogger().info("onEnable is called.");

        public void onDisable() {
            getLogger().info("onDisable is called.");
        public boolean onCommand(CommandSender sender, CommandSender cmd, String label, String[] args) {

            if (!(sender instanceof Player)) {
                sender.sendMessage(ChatColor.RED + "Only players can use this command.");
                return true;


            if (cmd.getName().equalsIgnoreCase("command")) {
                return true;
         return true;
    Pom file:
    Code (Text):

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns=""






  2. SteelPhoenix


    If you would use the @Override annotation you would get an indicator your #onCommand() method does not override anything
  3. ?
  4. Your onCommand method is wrong. If you used the Override annotation, you would get a warning.
    Your second parameter is a CommandSender, should be a command.
    If you're using Eclipse you can use Ctrl + Space to automatically suggest methods to override. Not sure what the is the combination for other IDEs.
  5. It would be CTRL + N and selecting Override
    or CMD + O (CMD on mac not sure for windows)
    for Intellij Idea by default