Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. package me.benyou.default_kits.events;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.Material;
  5. import org.bukkit.Sound;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.event.EventHandler;
  8. import org.bukkit.event.Listener;
  9. import org.bukkit.event.block.Action;
  10. import org.bukkit.event.player.PlayerInteractEvent;
  11.  
  12. import me.benyou.Main;
  13. import me.benyou.Utils;
  14.  
  15. public class HermesEvent implements Listener {
  16.  
  17. private Main pl;
  18.  
  19. public HermesEvent(Main pl) {
  20. this.pl = pl;
  21. }
  22.  
  23. @EventHandler
  24. public void onIronMan(PlayerInteractEvent e) {
  25. Player p = e.getPlayer();
  26.  
  27. if(!(this.pl.hermes.contains(p.getName()))) {
  28. return;
  29. }
  30.  
  31. if(p.getItemInHand().getType() != Material.FEATHER) {
  32. return;
  33. }
  34.  
  35. if ((!e.getAction().equals(Action.LEFT_CLICK_AIR)) && (!e.getAction().equals(Action.RIGHT_CLICK_AIR)) &&
  36. (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) && (!e.getAction().equals(Action.LEFT_CLICK_BLOCK))) {
  37. p.getItemInHand().getType();
  38. }
  39.  
  40. if(this.pl.hermesCooldown.contains(p.getName())) {
  41. p.sendMessage(ChatColor.GRAY + "Vous ne pouvez pas encore faire cela.");
  42. } else {
  43. this.pl.hermesCooldown.add(p.getName());
  44. p.setAllowFlight(true);
  45. p.setFlying(true);
  46. p.sendMessage(ChatColor.GRAY + "Vous vous envolez pour 10 secondes !");
  47.  
  48. this.pl.getServer().getScheduler().runTaskLater(this.pl, new Runnable() {
  49.  
  50. @Override
  51. public void run() {
  52. p.sendMessage(ChatColor.GRAY + "Vous ne pouvez plus voler !");
  53. p.setFlying(false);
  54. p.setAllowFlight(false);
  55. }
  56. }, 200L);
  57.  
  58. this.pl.getServer().getScheduler().runTaskLater(this.pl, new Runnable() {
  59.  
  60. @Override
  61. public void run() {
  62. pl.hermesCooldown.remove(p.getName());
  63. Utils.cooldownMessage(p);
  64. p.playSound(p.getLocation(), Sound.LEVEL_UP, 10, 10);
  65. }
  66. }, 600L);
  67. return;
  68. }
  69. }
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement