From 5236f32c30b1d9e982aa31009ca1150b2a296406 Mon Sep 17 00:00:00 2001 From: MidSpike Date: Tue, 4 Aug 2026 21:47:39 -0400 Subject: [PATCH] Fix: `/back` onto nether roof exploit when destination is unsafe. - Created crude `isAboveNetherRoof` safeguard for `getSafeDestination`. --- .../com/earth2me/essentials/utils/LocationUtil.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 f9eb69c20cd..b8fceb3a1eb 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/utils/LocationUtil.java +++ b/Essentials/src/main/java/com/earth2me/essentials/utils/LocationUtil.java @@ -125,6 +125,13 @@ public static boolean isBlockOutsideWorldBorder(final World world, final int x, return x < x1 || x > x2 || z < z1 || z > z2; } + public static boolean isAboveNetherRoof(final World world, final int x, final int y, final int z) { + if (world.getEnvironment() != World.Environment.NETHER) { + return false; + } + return y >= world.getHighestBlockYAt(x, z); + } + public static int getXInsideWorldBorder(final World world, final int x) { final Location center = world.getWorldBorder().getCenter(); final int radius = (int) world.getWorldBorder().getSize() / 2; @@ -277,6 +284,9 @@ public static Location getSafeDestination(IEssentials ess, final Location loc) t } } } + if (isAboveNetherRoof(world, x, y, z)) { + y = world.getHighestBlockYAt(x, z) - 1; + } return new Location(world, x + 0.5, y, z + 0.5, loc.getYaw(), loc.getPitch()); }