Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.Hatter274;
- import java.util.HashSet;
- import java.util.Set;
- 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.inventory.ItemStack;
- public class Phantom implements Listener
- {
- Main plugin;
- public Phantom(Main instance)
- {
- this.plugin = instance;
- }
- private Set<String> cooldown = new HashSet<String>();
- @EventHandler
- public void onPlayerInteract(PlayerInteractEvent e)
- {
- final Player p = e.getPlayer();
- if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK)
- {
- if (cooldown.contains(p.getName()))
- {
- p.sendMessage(ChatColor.RED + "You Are Still On Cooldown!");
- } else {
- cooldown.add(p.getName());
- ItemStack helm = new ItemStack (Material.LEATHER_HELMET);
- ItemStack chest = new ItemStack (Material.LEATHER_CHESTPLATE);
- ItemStack leggs = new ItemStack (Material.LEATHER_LEGGINGS);
- ItemStack boots = new ItemStack (Material.LEATHER_BOOTS);
- helm.setDurability((short)(1));
- chest.setDurability((short)(1));
- leggs.setDurability((short)(1));
- boots.setDurability((short)(1));
- p.getInventory().setHelmet(helm);
- p.getInventory().setHelmet(chest);
- p.getInventory().setHelmet(leggs);
- p.getInventory().setHelmet(boots);
- p.setFlying(true);
- p.setAllowFlight(true);
- p.sendMessage(ChatColor.BLUE + "WOOSH! You Now Have Fly Abilities For 10 Seconds!");
- plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
- {
- @Override
- public void run()
- {
- p.setAllowFlight(false);
- p.setFlying(false);
- p.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
- p.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
- p.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_LEGGINGS));
- p.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_BOOTS));
- p.sendMessage("You Have Now Lost Your Fly Abilities");
- }
- }, 20L * 10L);
- plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
- {
- @Override
- public void run()
- {
- cooldown.remove(p.getName());
- p.sendMessage(ChatColor.BLUE + "You Can Now Use Your Feather Again!");
- }
- }, 20L * 30L);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement