Cooldown on Event

Discussion in 'Spigot Plugin Help' started by AlpDemirAlver, Apr 17, 2021.

Thread Status:
Not open for further replies.
  1. Hello, I am trying to add a cooldown on a event and tried multiple ways but they did not work out. I tried this and I get this error:

    Error:
    Plugin cannot be resolved to a variable

    Class that the event is on:

    Code (Text):

    public class Listeners implements Listener {
       
        private ArrayList<String> cooldown = new ArrayList<String>();
         
        @EventHandler
        public void onPlayerUse(PlayerInteractEvent event){
            Player p = event.getPlayer();
            if(event.getAction().equals(Action.RIGHT_CLICK_AIR)) {
                if(event.getPlayer().getInventory().getItemInMainHand() == null)
                    return;
                if(!event.getPlayer().getInventory().getItemInMainHand().hasItemMeta())
                    return;
                if(!event.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasEnchant(CustomEnchants.ENDERGUCU))
                    return;
                if(event.getPlayer().getGameMode() == GameMode.CREATIVE || event.getPlayer().getGameMode() == GameMode.SPECTATOR)
                    return;
                cooldown.add(p.getName());
               
                Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Plugin, new Runnable() {
                    public void run() {
                        p.launchProjectile(EnderPearl.class);
                        p.sendMessage(ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "Ender Gücü" + ChatColor.GOLD + "'nü kullandın. 1 dakika beklemen gerek.");
                    }
                    }, 1200L);
                        }
                        }
                    }        
     
    I would be verry happy if someone could tell what causes this error, thanks.
     
Thread Status:
Not open for further replies.