I want to make an event that teleports you back up 200 blocks when fallen through void and turns off your fall damage, checks the block under you and sets your hearts to half a heart. How can I implement the turn fall damage off in my event?
Player player = event.getPlayer();
if (event.getTo().getBlockY() == 0) {
player.teleport(player.getLocation().add(0, 200, 0));
//turn fall damage off
if (player.getLocation().getBlock().getLocation().equals(-1)) {
if (player.getLocation().getBlock().getType() != Material.AIR) {
player.setHealth(1);
}
}
}