Skip to content

Commit 739600e

Browse files
authored
Fix safelogin for 1.18 and above by using worldProvider minHeight (#4715)
1 parent 5f98d3f commit 739600e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Essentials/src/main/java/com/earth2me/essentials/utils/LocationUtil.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ public static boolean shouldFly(IEssentials ess, final Location loc) {
266266
int y = (int) Math.round(loc.getY());
267267
final int z = loc.getBlockZ();
268268
int count = 0;
269+
// Check whether more than 2 unsafe block are below player.
269270
while (LocationUtil.isBlockUnsafe(ess, world, x, y, z) && y >= ess.getWorldInfoProvider().getMinHeight(world)) {
270271
y--;
271272
count++;
@@ -274,7 +275,8 @@ public static boolean shouldFly(IEssentials ess, final Location loc) {
274275
}
275276
}
276277

277-
return y < 0;
278+
// If not then check if player is in the void
279+
return y < ess.getWorldInfoProvider().getMinHeight(world);
278280
}
279281

280282
public static class Vector3D {

0 commit comments

Comments
 (0)