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

Teleport player to specify X, Y, Z and level

Comments in 'Plugin Development' started by mamayadesu, Apr 12, 2015.

  1. mamayadesu
    Offline

    mamayadesu Active Member Plugin Developer

    Joined:
    Sep 19, 2013
    Posts:
    146
    Plugins:
    4
    Minecraft User:
    mamayadesu
    How to do it?
    Last edited: Apr 12, 2015
  2. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    This is what I am using...

    PHP:
    $pos = new Vector3($x,$y,$z);
    $level $this->getServer()->getLevelByName($world);
    $player->teleport($level->getSafeSpawn($pos));
    Allthough, I think you could also do:
    PHP:
    $player->teleport(new Position($x,$y,$z,$level));
    xiaoq likes this.
  3. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    I think you are looking for
    PHP:
    $player->teleport(new Position($x$y$z$this->getServer()->getLevelByName("level name")));
    As @aliuly said
    EvolSoft and xiaoq like this.
  4. mamayadesu
    Offline

    mamayadesu Active Member Plugin Developer

    Joined:
    Sep 19, 2013
    Posts:
    146
    Plugins:
    4
    Minecraft User:
    mamayadesu
    Thank You.
  5. mamayadesu
    Offline

    mamayadesu Active Member Plugin Developer

    Joined:
    Sep 19, 2013
    Posts:
    146
    Plugins:
    4
    Minecraft User:
    mamayadesu
    Thank You.

Share This Page

Advertisement