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

Error : Reset World

Discussion in 'Development' started by LCraftPE, Nov 27, 2016.

  1. LCraftPE

    LCraftPE Silverfish

    Messages:
    20
    GitHub:
    LCraftPE
    Hello,
    When I want to reset a world, I have this error :
    Code:
    ClassNotFoundException: "Class ZipArchive not found" (EXCEPTION) in "/src/spl/BaseClassLoader" at line 144
    Here is my code :
    PHP:
      public function resetWorld(){   
        
    $name self::WORLD;
        
    $this->getServer()->unloadLevel($this->getServer()->getLevelByName($name));
        
    $zip = new \ZipArchive;
        
    $zip->open($this->getServer()->getDataFolder()."Map/".$name.".zip");
        
    $zip->extractTo($this->getServer()->getDataPath()."worlds");
        
    $zip->close();
        unset(
    $zip);
        
    $this->getServer()->loadLevel(self::WORLD);
      }
    Here is a tree of my plugins folder :
    Code:
    \---plugins
        |
        |
        +---world
        |  | TeamLives.zip
        |
        |
        |
        |
    ...
    Thank you :)
     
    Last edited: Dec 2, 2016
    SalmonDE likes this.
  2. SalmonDE

    SalmonDE Zombie Pigman

    Messages:
    739
    GitHub:
    SalmonDE
    I suppose you need the zip extension in your php binaries
     
  3. LCraftPE

    LCraftPE Silverfish

    Messages:
    20
    GitHub:
    LCraftPE
    How can I install this?
     
  4. SalmonDE

    SalmonDE Zombie Pigman

    Messages:
    739
    GitHub:
    SalmonDE
    Compile php with --enable-zip
     
  5. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    You should use the PHP binaries distributed by the PMMP team. Avoid using custom binaries (e.g. via aptitude) or binaries from other spoons.
     
    HimbeersaftLP likes this.
  6. TutoGamerWalid

    TutoGamerWalid Spider Ban Evader

    Messages:
    11
    GitHub:
    wiligangster
    PHP:
            $level $this->getServer()->getLevelByName("yourworld");
            
    $this->getServer()->unloadLevel($level);
            
    $zip = new \ZipArchive;
            
    $zip->open($this->getServer()->getDataPath()."yourfolder/yourworld.zip");
            
    $zip->extractTo($this->getServer()->getDataPath()."worlds/yourworld/");
            
    $zip->close();
     
    Last edited: Nov 29, 2016
  7. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    read OP
     
  8. TutoGamerWalid

    TutoGamerWalid Spider Ban Evader

    Messages:
    11
    GitHub:
    wiligangster
    WTF ? Me i Read Op ? Please stop answer what is problem with my code ?
     
  9. MrReskill

    MrReskill Creeper

    Messages:
    4
    GitHub:
    MrReskill
    The code is good, please stop with your "read oop", TutoGamerWalid is a good PHP Dev.
    Ps: the code is not wrong
     
    TutoGamerWalid likes this.
  10. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    Did i say oop? i said OP
     
    HimbeersaftLP likes this.
  11. TutoGamerWalid

    TutoGamerWalid Spider Ban Evader

    Messages:
    11
    GitHub:
    wiligangster
    Not oop...
     
    HimbeersaftLP likes this.
  12. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    I don't see what you have changed apart from changing some string literals and delete a few probably-useless-probably-useful lines. This post doesn't answer the question at all.
     
  13. MrReskill

    MrReskill Creeper

    Messages:
    4
    GitHub:
    MrReskill
  14. MrReskill

    MrReskill Creeper

    Messages:
    4
    GitHub:
    MrReskill
    Ok.
     
  15. TutoGamerWalid

    TutoGamerWalid Spider Ban Evader

    Messages:
    11
    GitHub:
    wiligangster
    Yes ;) dm me ;)
     
  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.