Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1.  
  2. private int timer1 = 30;
  3. private int task1;
  4.  
  5. private int timer = 6;
  6. private int task;
  7.  
  8.  
  9. private MaiN main;
  10.  
  11. public CheatListeners(MaiN chrono) {
  12. this.main = chrono;
  13. }
  14.  
  15. @EventHandler(priority = EventPriority.HIGHEST)
  16. public void onchurd(PlayerInteractEvent e) {
  17.  
  18. Player p = e.getPlayer();
  19. if(p.getItemInHand().getType().equals(Material.FEATHER)) {
  20.  
  21. if(!(MaiN.phantom.contains(p))) {
  22.  
  23. MaiN.phantom.add(p);
  24.  
  25. p.setAllowFlight(true);
  26. p.setFlying(true);
  27. World w = p.getWorld();
  28. w.playSound(p.getLocation(), Sound.ENDERDRAGON_GROWL, 16.0F, p.getLocation().getPitch());
  29.  
  30.  
  31. task = Bukkit.getScheduler().scheduleSyncRepeatingTask(main, new Runnable(){
  32.  
  33. @Override
  34. public void run() {
  35.  
  36. p.sendMessage("fly test");
  37. p.setExp((float) timer / 6);
  38.  
  39. if(timer == 0){
  40. p.sendMessage("stop fly");
  41. p.setAllowFlight(false);
  42. p.setFlying(false);
  43. Bukkit.getScheduler().cancelTask(task);
  44. timer = 7;
  45.  
  46. task1 = Bukkit.getScheduler().scheduleSyncRepeatingTask(main, new Runnable(){
  47.  
  48. @Override
  49. public void run() {
  50.  
  51. p.setLevel(timer1);
  52.  
  53. if(timer1 == 0){
  54. p.sendMessage("cooldown finish");
  55. Bukkit.getScheduler().cancelTask(task1);
  56. MaiN.phantom.remove(p);
  57. timer1 = 30;
  58. }
  59.  
  60.  
  61. timer1--;
  62.  
  63. }
  64.  
  65. },20,20);
  66.  
  67.  
  68. }
  69. timer--;
  70. }
  71. },20,20);
  72. } else {
  73. e.setCancelled(true);
  74. p.sendMessage("wait");
  75. }
  76. }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement