Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private int timer1 = 30;
- private int task1;
- private int timer = 6;
- private int task;
- private MaiN main;
- public CheatListeners(MaiN chrono) {
- this.main = chrono;
- }
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onchurd(PlayerInteractEvent e) {
- Player p = e.getPlayer();
- if(p.getItemInHand().getType().equals(Material.FEATHER)) {
- if(!(MaiN.phantom.contains(p))) {
- MaiN.phantom.add(p);
- p.setAllowFlight(true);
- p.setFlying(true);
- World w = p.getWorld();
- w.playSound(p.getLocation(), Sound.ENDERDRAGON_GROWL, 16.0F, p.getLocation().getPitch());
- task = Bukkit.getScheduler().scheduleSyncRepeatingTask(main, new Runnable(){
- @Override
- public void run() {
- p.sendMessage("fly test");
- p.setExp((float) timer / 6);
- if(timer == 0){
- p.sendMessage("stop fly");
- p.setAllowFlight(false);
- p.setFlying(false);
- Bukkit.getScheduler().cancelTask(task);
- timer = 7;
- task1 = Bukkit.getScheduler().scheduleSyncRepeatingTask(main, new Runnable(){
- @Override
- public void run() {
- p.setLevel(timer1);
- if(timer1 == 0){
- p.sendMessage("cooldown finish");
- Bukkit.getScheduler().cancelTask(task1);
- MaiN.phantom.remove(p);
- timer1 = 30;
- }
- timer1--;
- }
- },20,20);
- }
- timer--;
- }
- },20,20);
- } else {
- e.setCancelled(true);
- p.sendMessage("wait");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement