From 739600eb05721987f87917f9a3172e426819fddf Mon Sep 17 00:00:00 2001 From: Pierre Dedrie Date: Mon, 27 Dec 2021 00:56:03 +0100 Subject: [PATCH] Fix safelogin for 1.18 and above by using worldProvider minHeight (#4715) --- .../main/java/com/earth2me/essentials/utils/LocationUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/utils/LocationUtil.java b/Essentials/src/main/java/com/earth2me/essentials/utils/LocationUtil.java index 8ad5d1c127e..ae84c2aa43c 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/utils/LocationUtil.java +++ b/Essentials/src/main/java/com/earth2me/essentials/utils/LocationUtil.java @@ -266,6 +266,7 @@ public static boolean shouldFly(IEssentials ess, final Location loc) { int y = (int) Math.round(loc.getY()); final int z = loc.getBlockZ(); int count = 0; + // Check whether more than 2 unsafe block are below player. while (LocationUtil.isBlockUnsafe(ess, world, x, y, z) && y >= ess.getWorldInfoProvider().getMinHeight(world)) { y--; count++; @@ -274,7 +275,8 @@ public static boolean shouldFly(IEssentials ess, final Location loc) { } } - return y < 0; + // If not then check if player is in the void + return y < ess.getWorldInfoProvider().getMinHeight(world); } public static class Vector3D {