1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Mine reset error.

Discussion in 'Plugin Help' started by DanielYTK, Mar 7, 2017.

  1. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    My error is the following, when I create a mine, I leave it set, ready to use, it catches well, but when I reboot my server, it gives this error:
    Code:
    [Server thread/CRITICAL]: TypeError: "Argument 4 passed to minereset\Mine::__construct() must be an instance of pocketmine\level\Level, null given, called in phar://C:/Users/DanielYTK/Documents/PocketMine-MP/plugins/MineReset.phar/src/minereset/MineReset.php on line 198" (EXCEPTION) in "/MineReset.phar/src/minereset/Mine" at line 13
    
    Can anyone help me solve it?
     
  2. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    hello? ._.
     
  3. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    Im guessing the level is not loaded?
     
  4. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    Yes, but how can I resolve this?
     
  5. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    I tried this on onEnable (): but it did not work
    PHP:
    $this->getServer()->dispatchCommand(new ConsoleCommandSender(), "mw load --all")
    Does not work because it will execute the command, after reading all the files; How can I do anything to solve this?
     
  6. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    Do you know how to extract the plugin from phar?
    Edit MineReset.php
    PHP:
    public function parseMines(){
            foreach(
    $this->mineData->getAll() as $n => $m){
               if(!
    $this->getServer()->loadLevel($m[7])){
                   
    $this->getLogger()->error("Failed to load level $m[7] for mine $n");
                   continue;
               }
                if(
    $m[6] !== false){
                    
    $this->mines[$n] = new Mine($this, new Vector3(min($m[0], $m[1]), min($m[2], $m[3]), min($m[4], $m[5])), new Vector3(max($m[0], $m[1]), max($m[2], $m[3]), max($m[4], $m[5])), $this->getServer()->getLevelByName($m[7]), $m[6]);
                }
                else{
                    
    $this->mines[$n] = new Mine($this, new Vector3(min($m[0], $m[1]), min($m[2], $m[3]), min($m[4], $m[5])), new Vector3(max($m[0], $m[1]), max($m[2], $m[3]), max($m[4], $m[5])), $this->getServer()->getLevelByName($m[7]));
                }
            }
        }
     
    Last edited: Mar 8, 2017
  7. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    Yes, Yes... thanks :)
     
  8. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    error to reset a mine:
    Code:
    Unhandled exception executing command 'mine reset s1' in mine: Call to undefined method pocketmine\level\format\mcregion\Chunk::fastSerialize()
    [18:56:31] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\level\format\mcregion\Chunk::fastSerialize()" (EXCEPTION) in "/MineReset-master/src/minereset/Mine" at line 45
    
     
  9. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    function resetMine():
    PHP:
    public function resetMine(){
            
    $chunks = [];
            for (
    $x $this->getA()->getX(); $x-16 <= $this->getB()->getX(); $x += 16){
                for (
    $z $this->getA()->getZ(); $z-16 <= $this->getB()->getZ(); $z += 16) {
                    
    //$this->getLevel()->getServer()->getLogger()->info(Level::chunkHash($x >> 4, $z >> 4));
                    
    $chunk $this->level->getChunk($x >> 4$z >> 4true);
                    
    $chunkClass get_class($chunk);
                    
    $chunks[Level::chunkHash($x >> 4$z >> 4)] = $chunk->fastSerialize($chunk);
                }
            }

            
    //var_dump($chunks);
            
    $resetTask = new MineResetTask($chunks$this->a$this->b$this->data$this->getLevel()->getId(), $this->base->getRegionBlocker()->blockZone($this->a$this->b$this->level), $chunkClass);
            
    $this->base->scheduleReset($resetTask);
        }
     
  10. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    I think that plugin may have broken in one of the "game breaking" changes that @dktapps made to pocketmine in one of the API changes
     
  11. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    Either your version is outdated or you're using a spoon.
    `pocketmine\level\format\mcregion` namespace does not exist anymore.
     
  12. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    E qual é a versão atualizada?
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.