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

unload level crash

Comments in 'Plugin Development' started by Creeperface, Jul 26, 2015.

  1. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    PHP:
     $level->unload()
    crash:
    Error: Call to a member function getName() on null
    File: /src/pocketmine/level/Level__32bit
    Line: 2634
    Type: E_ERROR

    Code:
    [2625] return (int) $this->time;
    [2626] }
    [2627]
    [2628] /**
    [2629] * Returns the Level name
    [2630] *
    [2631] * @return string
    [2632] */
    [2633] public function getName(){
    [2634] return $this->provider->getName();
    [2635] }
    [2636]
    [2637] /**
    [2638] * Returns the Level folder name
    [2639] *
    [2640] * @return string
    [2641] */
    [2642] public function getFolderName(){
    [2643] return $this->folderName;
    [2644] }

    Backtrace:
    #0 /src/pocketmine/Server__32bit(0): pocketmine\Server->crashDump()
    #1 /src/pocketmine/Server__32bit(2355): pocketmine\level\Level->getName()
    #2 /src/pocketmine/Server__32bit(2503): pocketmine\Server->checkTickUpdates()
    #3 /src/pocketmine/Server__32bit(2306): pocketmine\Server->tick()
    #4 /src/pocketmine/Server__32bit(2184): pocketmine\Server->tickProcessor()
    #5 /src/pocketmine/Server__32bit(1784): pocketmine\Server->start()
    #6 /src/pocketmine/PocketMine(464): pocketmine\Server->__construct()
    #7 (1): ()
    #8 (0): {main}()

    PocketMine-MP version: 1.5dev #1255 [Protocol 27; API 1.12.0]
    Git commit: 0000000000000000000000000000000000000000
    uname -a: Windows NT MBW8 6.3 build 9200 (Windows 8.1 Business Edition) i586
    PHP Version: 5.6.4
    Zend version: 2.6.0
    OS : WINNT, win

    Loaded plugins:
    DevTools 1.10.0 by PocketMine Team for API(s) 1.3.1
    EssentialsPE 1.1.0 by LegendsOfMCPE Team for API(s) 1.12.0
    MCG76_WorldEdit 0.5.2 by minecraftgenius76 for API(s) 1.8.0
    PurePerms 1.1.6 by 64FF00 for API(s) 1.12.0
    WorldEditArt 1.0.0_beta_dev_#048 by PEMapModder for API(s) 1.0.0
    BedWars 1 by CreeperFace for API(s) 1.12.0

    how can i fix this?
  2. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    Try:
    PHP:
     $this->getServer()->unloadLevel($lv->getName(),true);
    Of course level must be loaded, so I suggest use try {}, like:
    PHP:
    try {
     
    $this->getServer()->unloadLevel($lv->getName(),true);
    }
     catch (
    Exception $e){
     
    $this->getLogger()->notice($e);
    }
    Minecrafter9203 likes this.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It should be $server->unloadLevel($level, $force).
    Minecrafter9203 and Creeperface like this.
  4. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace

Share This Page

Advertisement