Exempt players in webs from nofall

This commit is contained in:
h31ix committed 2012-12-29 12:05:55 -05:00
1 parent 8c837f0ec1
commit 08776d44db
2 files changed
+5 -1

No files matched your search

@@ -236,7 +236,7 @@ public class Backend {
public boolean checkNoFall(Player player, double y) { public boolean checkNoFall(Player player, double y) {
String name = player.getName(); String name = player.getName();
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping() && !isMovingExempt(player) && !justPlaced(player) && !Utilities.isInWater(player)) { if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping() && !isMovingExempt(player) && !justPlaced(player) && !Utilities.isInWater(player) && !Utilities.isInWeb(player)) {
if (player.getFallDistance() == 0) { if (player.getFallDistance() == 0) {
if (nofallViolation.get(name) == null) { if (nofallViolation.get(name) == null) {
nofallViolation.put(name, 1); nofallViolation.put(name, 1);
@@ -159,6 +159,10 @@ public final class Utilities {
return player.getLocation().getBlock().isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid(); return player.getLocation().getBlock().isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
} }
public static boolean isInWeb(Player player) {
return player.getLocation().getBlock().getType() == Material.WEB || player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.WEB || player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == Material.WEB;
}
public static boolean isClimbableBlock(Block block) { public static boolean isClimbableBlock(Block block) {
return block.getType() == Material.VINE || block.getType() == Material.LADDER; return block.getType() == Material.VINE || block.getType() == Material.LADDER;
} }