Fix top command only teleporting to the next air gap

This commit is contained in:
Spencer 2017-12-30 20:13:32 -05:00 committed by Alexander Meech
parent dfc6e12682
commit a68f4fd65c

View File

@ -23,17 +23,17 @@ public class TopCommand extends BaseCommand
{
Location destination = player.getLocation().clone();
while (destination.getBlock().getType() != Material.AIR
&& destination.add(0, 1, 0).getBlock().getType() != Material.AIR)
destination.setY(256);
while (destination.getBlock().getType().equals(Material.AIR))
{
if (destination.getY() > 256)
{
break;
}
destination.add(0, -1, 0);
}
_teleportManager.teleportPlayer(player, destination);
_teleportManager.teleportPlayer(player, destination.add(0, 1, 0));
message(player, "You have been teleported to Y = " + C.cYellow + destination.getY());
return true;
}
}