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

Map Resets!! (H3lp!!!)

Comments in 'Plugin Development' started by Samueljh1, Jan 21, 2015.

  1. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    Lol I am soooo stuck! Please help me reset my Skywars map so I can finish the plugin!!! :)
  2. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    So the question is... How do u reset maps??? :p
  3. TonyDroidd
    Offline

    TonyDroidd Active Member

    Joined:
    Sep 6, 2014
    Posts:
    180
    Minecraft User:
    TonyDroidd
    Use MineReset
  4. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    Nop, this won't work... i need to use it in my script whenever -_-
  5. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    use this to removed the old world

    PHP:
    $cmd->deletePlayWorld $playworld );
    PHP:
                    if ($playworld == null) {
                        
    $playworld "NameWorldwill be cloned";
                    }
  6. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Save the world in your plugin's folder, then clone it to server's world folder, and it's all xD
    Praxthisnovcht likes this.
  7. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    ^^
    PEMapModder likes this.
  8. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    No, don't force the directory, you can get it by using:
    Server::getInstance()->getDataFolder()
  9. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    It is easier to make a clone?
    Example: World1 is the basic world.
    The world is the world World1_play or what passes games.

    Or like the code below, just reset the map?
  10. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    It's the same xD but you can prevent corruptions if you save it anywhere else where the server doesn't touch it automatically
  11. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    Lol i have made a solution myself xD Lol i was doing it while you were replying and didn't realise! :p

    Here is the code! (Just a recursive copy thingy :p)

    <?php

    public function copyr($source, $dest){

    $main = new main();
    // Check for symlinks
    if (is_link($source)) {
    return symlink(readlink($source), $dest);
    }

    // Simple copy for a file
    if (is_file($source)) {
    return copy($source, $dest);
    }

    // Make destination directory
    if (!is_dir($dest)) {
    mkdir($dest);
    }

    // Loop through the folder
    $dir = dir($source);
    while (false !== $entry = $dir->read()) {
    // Skip pointers
    if ($entry == '.' || $entry == '..') {
    continue;
    }

    // Deep copy directories
    $main->copyr("$source/$entry", "$dest/$entry");
    }

    // Clean up
    $dir->close();
    return true;
    }
  12. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    P.s How do u use code syntax? is it <code>?</code>??
  13. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    Guys, its done now :p But, I recommend having a base map (I'll give u an example with my Skywars mod :p)

    Original Map: Skywars_

    Then copy that map to "Skywars"

    Then the plugin uses the map "Skywars", and then whenever it needs to be reset, I will copy the " Skywars_" folder and replace it :p
  14. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    That's good :D
  15. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No, the directory of worlds is $server->getDataPath() . "worlds/".
  16. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    Yea. Use this if you are running your own server. If you are using hosting, your world's folder will be saved in ./worlds (yea its a weard place :p)

Share This Page

Advertisement