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

Getting the world a player is in?

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

  1. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    Here is the code I would like to use:
    PHP:
    $level $this->getServer()->getLevelByName("Hub");
    Now I want to be able to replace "Hub" with the world the player is currently in. How do I do this?
  2. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    PHP:
    $level $player->getLevel();
    Primus and applqpak like this.
  3. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    PHP:
    $level $player->getLevel()->getName();
    In case you want to get the level's name...
  4. Hittmana
    Offline

    Hittmana Active Member

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

Share This Page

Advertisement