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

This commit is contained in:
Brettflan 2012-10-25 01:04:23 -05:00
parent 79bc2f46c0
commit 28e76340ea
1 changed files with 2 additions and 1 deletions

View File

@ -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++){