1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-13 18:14:38 +02:00

Fix safety tp check above world height

Performance tweak to fly check
This commit is contained in:
KHobbits
2014-02-23 17:41:25 +00:00
parent 088c54e386
commit 2d5c1fd51c

View File

@@ -215,6 +215,10 @@ public class LocationUtil
static boolean isBlockAboveAir(final World world, final int x, final int y, final int z)
{
if (y > world.getMaxHeight())
{
return true;
}
return HOLLOW_MATERIALS.contains(world.getBlockAt(x, y - 1, z).getType().getId());
}
@@ -347,15 +351,17 @@ public class LocationUtil
final int x = loc.getBlockX();
int y = (int)Math.round(loc.getY());
final int z = loc.getBlockZ();
int count = 0;
while (LocationUtil.isBlockUnsafe(world, x, y, z) && y > -1)
{
y--;
count++;
if (count > 2)
{
return true;
}
}
if (loc.getBlockY() - y > 1 || y < 0)
{
return true;
}
return false;
return y < 0 ? true : false;
}
}