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

Error of UnloadLevel

Comments in 'Plugin Development' started by Valeron, Nov 25, 2015.

  1. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    PocketMine-MP Crash Dump Wed Nov 25 15:48:59 UTC 2015

    Error: Call to a member function getName() on null
    File: /src/pocketmine/level/Level__32bit
    Line: 2734
    Type: E_ERROR

    Code:
    [2725] return (int) $this->time;
    [2726] }
    [2727]
    [2728] /**
    [2729] * Returns the Level name
    [2730] *
    [2731] * @return string
    [2732] */
    [2733] public function getName(){
    [2734] return $this->provider->getName();
    [2735] }
    [2736]
    [2737] /**
    [2738] * Returns the Level folder name
    [2739] *
    [2740] * @return string
    [2741] */
    [2742] public function getFolderName(){
    [2743] return $this->folderName;
    [2744] }

    Backtrace:
    #0 (): pocketmine\Server->crashDump(boolean)






    Error, when i try unload level
    My code:
    $levelname = $this->getServer()->getLevelByName("worlder");
    $check = count($this->getServer()->getLevelByName("worlder")->getPlayers());
    if($check == 0){
    $this->reseting($levelname);
    /*$lvl = $this->getServer()->getLevelByName("worlder");
    $this->getServer()->unloadLevel($lvl);*/
    }
    }
    }
    }
    }
    }
    }
    //==================================
    public function reseting(Level $level){
    $this->getServer()->unloadLevel($level);
    }
  2. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    You made (?) those mistakes:

    1) Firstly, onEnable(), add ...loadLevel("worlder");
    2) Your world isn't loaded => You can't use getLevelByName();
    3) It can also crash when you try to unload Level which is not loaded ;)
  3. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    3) hmm.....
  4. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    World has been loaded by code.
    loadLevel in OnEnable
  5. Driesboy1
    Offline

    Driesboy1 Active Member

    Joined:
    Oct 28, 2015
    Posts:
    102
    Minecraft User:
    Driesboy
    do you have create this code
  6. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    Yes
  7. Driesboy1
    Offline

    Driesboy1 Active Member

    Joined:
    Oct 28, 2015
    Posts:
    102
    Minecraft User:
    Driesboy

Share This Page

Advertisement