Advertisement
Guest User

Phantom Kit - - HELP PLZ

a guest
May 18th, 2014
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. package me.Hatter274;
  2.  
  3. import java.util.HashSet;
  4. import java.util.Set;
  5.  
  6. import org.bukkit.ChatColor;
  7. import org.bukkit.Material;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.event.EventHandler;
  10. import org.bukkit.event.Listener;
  11. import org.bukkit.event.block.Action;
  12. import org.bukkit.event.player.PlayerInteractEvent;
  13. import org.bukkit.inventory.ItemStack;
  14.  
  15. public class Phantom implements Listener
  16. {
  17.  
  18. Main plugin;
  19. public Phantom(Main instance)
  20. {
  21. this.plugin = instance;
  22. }
  23.  
  24. private Set<String> cooldown = new HashSet<String>();
  25.  
  26. @EventHandler
  27. public void onPlayerInteract(PlayerInteractEvent e)
  28. {
  29. final Player p = e.getPlayer();
  30. if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK)
  31. {
  32. if (cooldown.contains(p.getName()))
  33. {
  34. p.sendMessage(ChatColor.RED + "You Are Still On Cooldown!");
  35. } else {
  36. cooldown.add(p.getName());
  37. ItemStack helm = new ItemStack (Material.LEATHER_HELMET);
  38. ItemStack chest = new ItemStack (Material.LEATHER_CHESTPLATE);
  39. ItemStack leggs = new ItemStack (Material.LEATHER_LEGGINGS);
  40. ItemStack boots = new ItemStack (Material.LEATHER_BOOTS);
  41. helm.setDurability((short)(1));
  42. chest.setDurability((short)(1));
  43. leggs.setDurability((short)(1));
  44. boots.setDurability((short)(1));
  45. p.getInventory().setHelmet(helm);
  46. p.getInventory().setHelmet(chest);
  47. p.getInventory().setHelmet(leggs);
  48. p.getInventory().setHelmet(boots);
  49. p.setFlying(true);
  50. p.setAllowFlight(true);
  51. p.sendMessage(ChatColor.BLUE + "WOOSH! You Now Have Fly Abilities For 10 Seconds!");
  52. plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
  53. {
  54. @Override
  55. public void run()
  56. {
  57. p.setAllowFlight(false);
  58. p.setFlying(false);
  59. p.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
  60. p.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
  61. p.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_LEGGINGS));
  62. p.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_BOOTS));
  63. p.sendMessage("You Have Now Lost Your Fly Abilities");
  64. }
  65. }, 20L * 10L);
  66. plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
  67. {
  68. @Override
  69. public void run()
  70. {
  71. cooldown.remove(p.getName());
  72. p.sendMessage(ChatColor.BLUE + "You Can Now Use Your Feather Again!");
  73. }
  74. }, 20L * 30L);
  75. }
  76. }
  77. }
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement