mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-13 10:04:51 +02:00
Fix safety tp check above world height
Performance tweak to fly check
This commit is contained in:
@@ -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--;
|
||||
}
|
||||
|
||||
if (loc.getBlockY() - y > 1 || y < 0)
|
||||
count++;
|
||||
if (count > 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return y < 0 ? true : false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user