Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. package me.ekits.listeners;
  2.  
  3.  
  4. import java.util.ArrayList;
  5. import java.util.List;
  6.  
  7. import me.ekits.main.Kits;
  8. import me.ekits.main.Main;
  9.  
  10.  
  11.  
  12. import org.bukkit.Bukkit;
  13. import org.bukkit.ChatColor;
  14. import org.bukkit.Material;
  15. import org.bukkit.entity.Player;
  16. import org.bukkit.event.EventHandler;
  17. import org.bukkit.event.Listener;
  18. import org.bukkit.event.block.Action;
  19. import org.bukkit.event.player.PlayerInteractEvent;
  20. import org.bukkit.potion.PotionEffect;
  21. import org.bukkit.potion.PotionEffectType;
  22.  
  23. public class Assassin implements Listener{
  24.  
  25. Main plugin;
  26. public Assassin(Main instance) {
  27. this.plugin = instance;
  28. }
  29. List<Player> cooldown = new ArrayList<Player>();
  30. @SuppressWarnings("deprecation")
  31. @EventHandler
  32. public void Interact(PlayerInteractEvent e) {
  33. final Player p = e.getPlayer();
  34. Action action = e.getAction();
  35. if (Kits.assassin.contains(p.getName())) {
  36. if(p.getItemInHand().getType() != Material.SUGAR) return;
  37. if(!(cooldown.contains(p)))
  38. {
  39. if(action.equals(Action.RIGHT_CLICK_AIR) || action.equals(Action.RIGHT_CLICK_BLOCK)) {
  40. p.sendMessage(ChatColor.AQUA + "Gaining speed boost!");
  41. p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 80, 1),true);
  42. }
  43. cooldown.add(p);
  44.  
  45. Bukkit.getScheduler().scheduleAsyncDelayedTask(plugin, new Runnable() {
  46.  
  47. public void run() {
  48. cooldown.remove(p);
  49. p.sendMessage(ChatColor.GREEN + "You can run again!");
  50. }
  51. }, 200L);
  52.  
  53. } else p.sendMessage(ChatColor.RED + "You are still exhausted!");
  54.  
  55. }
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement