From 28e76340ea0f743abc6e94f55ddcc10ff4d8e304 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Thu, 25 Oct 2012 01:04:23 -0500 Subject: [PATCH] Added artificial height limit for Nether worlds, to work around CraftBukkit bug which reports a max height of 255 for them, leading to players being teleported on top of the "roof" of the Nether at height 127 --- src/com/wimbli/WorldBorder/BorderData.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/wimbli/WorldBorder/BorderData.java b/src/com/wimbli/WorldBorder/BorderData.java index f52b610..61b6696 100644 --- a/src/com/wimbli/WorldBorder/BorderData.java +++ b/src/com/wimbli/WorldBorder/BorderData.java @@ -211,7 +211,8 @@ public class BorderData // find closest safe Y position from the starting position private double getSafeY(World world, int X, int Y, int Z) { - final int limTop = world.getMaxHeight() - 2; + // artificial height limit of 127 added for Nether worlds since CraftBukkit still incorrectly returns 255 for their max height, leading to players sent to the "roof" of the Nether + final int limTop = (world.getEnvironment() == World.Environment.NETHER) ? 125 : world.getMaxHeight() - 2; // Expanding Y search method adapted from Acru's code in the Nether plugin for(int y1 = Y, y2 = Y; (y1 > limBot) || (y2 < limTop); y1--, y2++){