Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.ekits.listeners;
- import java.util.ArrayList;
- import java.util.List;
- import me.ekits.main.Main;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- public class Assassin implements Listener{
- Main plugin;
- public Assassin(Main instance) {
- this.plugin = instance;
- }
- List<Player> cooldown = new ArrayList<Player>();
- @SuppressWarnings("deprecation")
- @EventHandler
- public void Interact(PlayerInteractEvent e) {
- final Player p = e.getPlayer();
- Action action = e.getAction();
- if(p.getItemInHand().getType() != Material.SUGAR) return;
- if(!(cooldown.contains(p)))
- {
- if (Assassin.contains(p.getName()))
- if(action.equals(Action.RIGHT_CLICK_AIR) || action.equals(Action.RIGHT_CLICK_BLOCK)) {
- p.sendMessage(ChatColor.AQUA + "Gaining speed boost!");
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 80, 1),true);
- }
- cooldown.add(p);
- Bukkit.getScheduler().scheduleAsyncDelayedTask(plugin, new Runnable() {
- public void run() {
- cooldown.remove(p);
- p.sendMessage(ChatColor.GREEN + "You can run again!");
- }
- }, 200L);
- } else p.sendMessage(ChatColor.RED + "You are still exhausted!");
- }
- public static boolean contains(String name) {
- // TODO Auto-generated method stub
- return false;
- }
- public static void remove(String name) {
- // TODO Auto-generated method stub
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement