Teleport a player "up"

Discussion in 'Plugin Development' started by Daniel Heppner, Mar 13, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Daniel Heppner

    I have a simple question: how do I teleport a player to the top of the map, directly above where they're standing? Say I have a Location, how would I modify that to be the same X and Z but make Y 130, which would be two blocks above the top of the map, so that they don't suffocate if there is already a block there. I might also want to use this with another player, so I might have the Location of another player, and the user might type /tp danielhep up which would teleport the person directly above danielhep, at the top of the map.
  2. Offline


    You should just create a new Location for that place "over the map" and then teleport player there.

    player.teleportTo(new Location(player.getLocation().getX(), 130, player.getLocation().getZ()));

    Something like that ;)
Thread Status:
Not open for further replies.

Share This Page