Solved need help with gui plugin dev

Discussion in 'Spigot Plugin Development' started by Mhmdpro, Sep 19, 2020.

  1. in my command class it shows an error "The method onCommand(CommandSender, Command, String, String[]) of type Command must override or implement a supertype method"
    pls help
    package me.adarkzmc.guitest.command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;

    import me.adarkzmc.guitest.Main;
    import me.adarkzmc.guitest.ui.TestUI;

    public class Command implements CommandExecutor {

    private Main plugin;

    public Command(Main plugin) {
    this.plugin = plugin;


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

    if (!(sender instanceof Player)) {
    return true;

    Player p = (Player) sender;

    if (p.hasPermission("test1.use")) {
    return false;

  2. If you name your command-class „command“, the argument of onCommand(...,Command,. ) will be of the same type. Either change the class of your command to something more descriptive (e.g. TestCommand), or change the signature to public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String Label, String[] args)
  3. Its "Command"
  4. Yes, that class name for your command conflicts with Bukkit’s Command class. So, Java is thinking that Command in the onCommand method is referring to your Command instead of Bukkit’s Command.

    You should change the name of your command class to something else.
    • Agree Agree x 1
  5. Oh ok thanks btw i literally tried everything and this is the problem noice