private static boolean checkLift(PlayerInterface player, WorldInterface w, Vector pt, boolean up) {
//int x = pt.getBlockX();
int y1 = pt.getBlockY();
//int z = pt.getBlockZ();
SignInterface sign = getSign(w, pt, up);
// Found our stop?
if (sign != null) {
// We are going to be teleporting to the same place as the player
// is currently, except with a shifted Y
int plyX = (int) Math.floor(player.getPosition().getX());
//int plyY = (int)Math.floor(player.getY());
int plyZ = (int) Math.floor(player.getPosition().getZ());
int y2;
int foundFree = 0;
boolean foundGround = false;
int startingY = BlockType.canPassThrough(w.getId(plyX, y1 + 1, plyZ))
? y1 + 1 : y1;
// Step downwards until we find a spot to stand
for (y2 = startingY; y2 >= y1 - 5; y2--) {
int id = w.getId(plyX, y2, plyZ);
// We have to find a block that the player won't fall through
if (!BlockType.canPassThrough(id)) {
foundGround = true;
break;
}
foundFree++;
}
if (foundFree < 2) {
player.sendMessage(Colors.GOLD + "Uh oh! You would be obstructed!");
return false;
}
if (!foundGround) {
player.sendMessage(Colors.GOLD + "Uh oh! You would have nothing to stand on!");
return false;
}
// Teleport!
player.setPosition(new Vector(player.getPosition().getX(), y2 + 1, player.getPosition().getZ()),
(float) player.getYaw(), (float) player.getPitch());
// Now, we want to read the sign so we can tell the player
// his or her floor, but as that may not be avilable, we can
// just print a generic message
String title = sign.getLine1();
if (title.length() != 0) {
player.sendMessage(Colors.GOLD + "Floor: " + title);
} else {
player.sendMessage(Colors.GOLD + "You went "