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

[New Api] Get all levels

Comments in 'Plugin Development' started by Adaasi, Oct 18, 2014.

  1. Adaasi
    Offline

    Adaasi Active Member

    Joined:
    Aug 14, 2014
    Posts:
    80
    How can I get loaded and unloaded pocketmine worlds?
  2. SuperMarcus
    Offline

    SuperMarcus New Member Plugin Developer

    Joined:
    Jan 2, 2014
    Posts:
    16
    Plugins:
    2
    Minecraft User:
    MarcusZhou
    You may use $server->getLevels()
  3. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Try with this code:
    PHP:
    Server::getInstance()->loadLevel($name);
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    He isn't asking for this...

    anyway, read the documentation for pocketmine\Server
    Last edited by a moderator: Oct 19, 2014
    EvolSoft likes this.
  5. Adaasi
    Offline

    Adaasi Active Member

    Joined:
    Aug 14, 2014
    Posts:
    80
    I didn't find never about this
  6. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    You can try to get all levels in PocketMine world directory using PHP functions, then if you want to be sure that levels aren't corrupted... you can use:
    PHP:
    Server::getInstance()->loadLevel($name);
    If it returns false the level is corrupted (or other)...

    Please Like if I helped you :)
    Adaasi likes this.
  7. Adaasi
    Offline

    Adaasi Active Member

    Joined:
    Aug 14, 2014
    Posts:
    80
    Thank you :)
    I used scandir() first then I checked the level using your code
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP functions?
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Last time, don't use Server::getInstance() unless necessary

Share This Page

Advertisement