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

Teleport Player between worlds with a command?

Comments in 'Plugin Development' started by cake23, Aug 11, 2015.

  1. cake23
    Offline

    cake23 Active Member

    Joined:
    Aug 10, 2015
    Posts:
    124
    Minecraft User:
    TheEnd
    How i can teleport a player to a world if the player make /world1? Thank you! :)
  2. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV
    Paid plugin request?
  3. cake23
    Offline

    cake23 Active Member

    Joined:
    Aug 10, 2015
    Posts:
    124
    Minecraft User:
    TheEnd
  4. GmWM
    Offline

    GmWM Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    181
    Plugins:
    3
    PocketMine has a /world <worldname> command. Check that out.
    cake23 likes this.
  5. cake23
    Offline

    cake23 Active Member

    Joined:
    Aug 10, 2015
    Posts:
    124
    Minecraft User:
    TheEnd
    Oh okay, thank you!
  6. GmWM
    Offline

    GmWM Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    181
    Plugins:
    3
    No problem.
  7. TigerHix
    Offline

    TigerHix Active Member

    Joined:
    May 11, 2015
    Posts:
    61
    Minecraft User:
    TigerHix
    Assuming you already know how to register a command, the code for teleportation to another level is an one-liner:

    PHP:
    $player->teleport($targetLevel->getSpawnLocation());
    If you have problems with getting the $targetLevel, here's how you can get a level by name:

    PHP:
    $targetLevel Server::getInstance()->getLevelByName("LevelName");
    It is suggested to have your own instance of Server instead of calling the static function to acquire the singleton instance, but as long as you are doing all this on main thread, there shouldn't be a problem.
    cake23 likes this.
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    There shouldn't be a problem if pthreads doesn't have a problem.
    TigerHix likes this.
  9. cake23
    Offline

    cake23 Active Member

    Joined:
    Aug 10, 2015
    Posts:
    124
    Minecraft User:
    TheEnd
    Thank you very much! <3
  10. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    /world is from EssentialsPE :p

Share This Page

Advertisement