@EventHandler public void doubleJump(PlayerToggleFlightEvent event) { final Player player = event.getPlayer(); if (event.isFlying() && FOPM_TFM_Util.isDoubleJumper(player)) { player.setFlying(false); Vector jump = player.getLocation().getDirection().multiply(2).setY(1.1); player.setVelocity(player.getVelocity().add(jump)); event.setCancelled(true); } }
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerJump(PlayerMoveEvent event) { Location from = event.getFrom(); Location to = event.getTo(); if (to.getBlockY() > from.getBlockY()) { Player player = event.getPlayer(); if (FOPM_TFM_Util.isDoubleJumper(player)) { player.setAllowFlight(true); } } }