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

Chunk crash after reloading by plugin

Comments in 'Plugin Development' started by MrGenga, Jun 27, 2016.

  1. MrGenga
    Offline

    MrGenga Active Member

    Joined:
    Jul 24, 2015
    Posts:
    75
    Minecraft User:
    MrGenga
    Hello! I have crash, when player enter the map, what reloaded by plugin.
    Code for reload:
    PHP:
    //Teleport all to default world
    $this->getServer()->unloadLevel($this->map);
    $this->getServer()->loadLevel($this->mapName); //mapName is already saved variable
    There is no error in console. But, when player join this world, PocketMine crashs:
    Code:
    Fatal error: Call to a member function getChunk on null in phar:///home/sw/PocketMine-MP.phar/src/pocketmine/level/Level.php on line 2765
    
    Provider in Level is null, but why and how to fix this?
  2. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    What is mapNam! You should check if it is a valid level name. Or do something like this:
    var_dump($this->getServer()->getLevelByName($mapName) instanxeof Level)
  3. MrGenga
    Offline

    MrGenga Active Member

    Joined:
    Jul 24, 2015
    Posts:
    75
    Minecraft User:
    MrGenga
    It is right, because this level is load by this mapName in onEnable. But after REload map is broken
  4. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    You have to still check... Show me the output of loadLevel then.

Share This Page

Advertisement