Fixed y-level off-by-one issue on random spawn

Fixed wall-suffocation issue on random spawn
This commit is contained in:
rhajii
2017-04-30 17:35:54 -05:00
parent fdeb3d73a6
commit df2db10f8d

View File

@@ -155,8 +155,8 @@ public class RandomSpawn extends JavaPlugin{
double r = exclusionRadius + Math.random() * (radius - exclusionRadius);
double phi = Math.random() * 2d * Math.PI;
double x = center.getX() + Math.cos(phi) * r;
double z = center.getZ() + Math.sin(phi) * r;
double x = Math.round(center.getX() + Math.cos(phi) * r);
double z = Math.round(center.getZ() + Math.sin(phi) * r);
result.setX(x);
result.setZ(z);
@@ -230,6 +230,7 @@ public class RandomSpawn extends JavaPlugin{
blockid = world.getBlockTypeIdAt((int) x, (int) y, (int) z);
}
if(y == 0) return -1;
y++;
}
if (blacklist.contains(blockid)) return -1;