Problem with my plugin

Discussion in 'Spigot Plugin Help' started by alessio2010, May 9, 2017.

  1. Hello! I started learning java and bukkit. With the help of a tutorial i made a really basic plugin but i don't understand why whenever i type the command in the chat is sends the command in the chat. Example,
    https://i.gyazo.com/c76d16a8648f9d644dce29a9937c47b4.png

    My code for that command

    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {

    if (!(sender instanceof Player)) {
    sender.sendMessage("The console ran this command");
    return true;
    }

    Player player = (Player) sender;

    if (cmd.getName().equalsIgnoreCase("danik")) {

    player.sendMessage(ChatColor.GOLD + "Amazing!");

    }

    if (cmd.getName().equalsIgnoreCase("alessio")) {

    player.sendMessage(ChatColor.GOLD + "rollout hahaahahah snorlax");

    }



    return false;



    }
    }
     
  2. electronicboy

    IRC Staff

    returning false from onCommand will print the usage syntax to the player
     
    • Like Like x 1
  3. Ohhh, i see. Thank you fine gentleman.