From aa7b770c0339e2fcb03c400aacb715aa75e55a6b Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 31 Jan 2017 16:45:02 +1100 Subject: [PATCH] tweak highest block check --- .../com/plotsquared/bukkit/util/BukkitUtil.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java index b5f3e9c6e..a06888751 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -181,8 +181,19 @@ public class BukkitUtil extends WorldUtil { World bukkitWorld = getWorld(world); for (int y = bukkitWorld.getMaxHeight() - 1; y > 0; y--) { Block block = bukkitWorld.getBlockAt(x, y, z); - if (block != null && block.getType().isSolid()) { - return y+1; + if (block != null) { + Material type = block.getType(); + if (type.isSolid()) { + return y + 1; + } else { + switch (type) { + case WATER: + case LAVA: + case STATIONARY_LAVA: + case STATIONARY_WATER: + return y; + } + } } } return 0;