Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.benyou.default_kits.events;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- 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 me.benyou.Main;
- import me.benyou.Utils;
- public class HermesEvent implements Listener {
- private Main pl;
- public HermesEvent(Main pl) {
- this.pl = pl;
- }
- @EventHandler
- public void onIronMan(PlayerInteractEvent e) {
- Player p = e.getPlayer();
- if(!(this.pl.hermes.contains(p.getName()))) {
- return;
- }
- if(p.getItemInHand().getType() != Material.FEATHER) {
- return;
- }
- if ((!e.getAction().equals(Action.LEFT_CLICK_AIR)) && (!e.getAction().equals(Action.RIGHT_CLICK_AIR)) &&
- (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) && (!e.getAction().equals(Action.LEFT_CLICK_BLOCK))) {
- p.getItemInHand().getType();
- }
- if(this.pl.hermesCooldown.contains(p.getName())) {
- p.sendMessage(ChatColor.GRAY + "Vous ne pouvez pas encore faire cela.");
- } else {
- this.pl.hermesCooldown.add(p.getName());
- p.setAllowFlight(true);
- p.setFlying(true);
- p.sendMessage(ChatColor.GRAY + "Vous vous envolez pour 10 secondes !");
- this.pl.getServer().getScheduler().runTaskLater(this.pl, new Runnable() {
- @Override
- public void run() {
- p.sendMessage(ChatColor.GRAY + "Vous ne pouvez plus voler !");
- p.setFlying(false);
- p.setAllowFlight(false);
- }
- }, 200L);
- this.pl.getServer().getScheduler().runTaskLater(this.pl, new Runnable() {
- @Override
- public void run() {
- pl.hermesCooldown.remove(p.getName());
- Utils.cooldownMessage(p);
- p.playSound(p.getLocation(), Sound.LEVEL_UP, 10, 10);
- }
- }, 600L);
- return;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement