Advertisement
Guest User

Untitled

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