Set location with command

Discussion in 'Plugin Development' started by LeBlanc, Feb 26, 2017.

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

    LeBlanc

    Plz, i need to set the player's (sender) location with a command (X, Y, Z, Yaw and Pitch), and after I need to teleport player with other command...

    Example:

    command /chain setlobby > Save player's location
    command /chain join > Teleport player to lobby

    Sorry for my bad english, I researched, but I did not find anything about this, only topics of save location in a .yml file...
     
  2. Offline

    ipodtouch0218

    All you want is a /setspawn and a /spawn command?
    If you want to have the location persist after reload or restart you will need to set it to a config.yml.
    If you want it per-player, save a HashMap<UUID,Location>
     
  3. Offline

    Irantwomiles

    When you run the command do these steps

    1) save the location in a local variable

    2) save the x, y, z, pitch, yaw, and world to config (i always get errors trying to save the actual location object to file)

    3) when a player runs the command or how ever you want to use the location, grab the fields you saved to config and construct a new location and teleport the player to it.
     
    Last edited: Feb 27, 2017
Thread Status:
Not open for further replies.

Share This Page