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

Solved Get a level object from it's string name?

Comments in 'Plugin Development' started by MooShoe, Dec 29, 2015.

  1. MooShoe
    Offline

    MooShoe New Member

    Joined:
    Dec 27, 2015
    Posts:
    16
    Minecraft User:
    StevieBlock
    How do you get a level object with only it's name?
    ex. in Bukkit it's Bukkit.getServer().getWorld(String name)
  2. MooShoe
    Offline

    MooShoe New Member

    Joined:
    Dec 27, 2015
    Posts:
    16
    Minecraft User:
    StevieBlock
    lol I really need to learn to read - not post.
    For all of those who are looking for an answer use this:
    PHP:
    $this->getServer()->getLevelByName($name); // $name is yes, a string.
  3. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    A small tip:
    If you want get player level you'll have to use:
    PHP:
    $this->getServer()->getPlayer(/*player*/)->getLevel()->getName();
    Last edited: Dec 29, 2015
  4. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    You forgot "-" on your getPlayer()->getLevel()
    MooShoe likes this.
  5. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    :p
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    getPlayer() accepts a parameter...
    PocketKiller likes this.
  7. MooShoe
    Offline

    MooShoe New Member

    Joined:
    Dec 27, 2015
    Posts:
    16
    Minecraft User:
    StevieBlock
    I can believe I did.

Share This Page

Advertisement