Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to teleport a player to x,y,z

Comments in 'Plugin Development' started by Hittmana, Feb 20, 2016.

  1. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    I would like to know how to teleport a player to an xyz in the world: world. What is the code for this?
  2. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    PHP:
    /*
    * @param Player $player
    */
    $level $this->getServer()->getLevelByName("world");
    $player->teleport(new Position($x,$y,$z,$level));
    Hittmana likes this.
  3. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    Ok thank you! Do I need to
    PHP:
    use
    anything with it?
  4. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    Maybe this...
    Code:
    use pocketmine\level\Position;
    
  5. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    Ok thanks!

Share This Page

Advertisement