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

how restore the original map

Comments in 'Plugin Development' started by a9eelsh, Nov 25, 2014.

  1. a9eelsh
    Offline

    a9eelsh New Member

    Joined:
    Nov 6, 2014
    Posts:
    16
    Minecraft User:
    a9eelsh
    I do I work on a new plugin pvp and needed restoration of the map after each game
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
    $levelName "minigame_temp_map";
    $baseMap "C:/Users/User/PocketMine-MP/minigame_map_base/";
    $tmpMap $this->getServer()->getDataPath() . "worlds/$levelName/";

    // copy map
    foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($baseMap)) as $file){
        
    $rel substr(realpath($file), strlen(realpath($baseMap)));
        
    copy($file$tmpMap $rel);
    }
    EvolSoft likes this.
  3. a9eelsh
    Offline

    a9eelsh New Member

    Joined:
    Nov 6, 2014
    Posts:
    16
    Minecraft User:
    a9eelsh
    and add loadLevel ??
    PEMapModder likes this.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Yes
  5. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
  6. a9eelsh
    Offline

    a9eelsh New Member

    Joined:
    Nov 6, 2014
    Posts:
    16
    Minecraft User:
    a9eelsh
    error copy($file, $tmpMap . $rel);
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Right it has to @mkdir(dirname($tmpMap . $rel), 0777, true) too
  8. a9eelsh
    Offline

    a9eelsh New Member

    Joined:
    Nov 6, 2014
    Posts:
    16
    Minecraft User:
    a9eelsh
    14:58:46 [CRITICAL] Could not execute task Callback#myplugin\main::finishGame: copy(): The first argument to copy() function cannot be a directory

Share This Page

Advertisement