mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Skip y=255, block when finding a free spot
This commit is contained in:
parent
31908090b8
commit
abfbeffbb0
@ -173,12 +173,14 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
public int getHighestBlock(String world, int x, int z) {
|
public int getHighestBlock(String world, int x, int z) {
|
||||||
World bukkitWorld = getWorld(world);
|
World bukkitWorld = getWorld(world);
|
||||||
// Skip top and bottom block
|
// Skip top and bottom block
|
||||||
for (int y = bukkitWorld.getMaxHeight() - 2; y > 0; y--) {
|
int air = 1;
|
||||||
|
for (int y = bukkitWorld.getMaxHeight() - 1; y >= 0; y--) {
|
||||||
Block block = bukkitWorld.getBlockAt(x, y, z);
|
Block block = bukkitWorld.getBlockAt(x, y, z);
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
Material type = block.getType();
|
Material type = block.getType();
|
||||||
if (type.isSolid()) {
|
if (type.isSolid()) {
|
||||||
return y + 1;
|
if (air > 1) return y + 1;
|
||||||
|
air = 0;
|
||||||
} else {
|
} else {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case WATER:
|
case WATER:
|
||||||
@ -187,6 +189,7 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
case STATIONARY_WATER:
|
case STATIONARY_WATER:
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
air++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user