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

Reset World

Comments in 'Plugin Development' started by GamesLoad, May 25, 2016.

  1. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    hello guys I wanted to know how to charge my world once the game is over I'm trying to make a plugin SkyWars
  2. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    turn off autosave and then when game ends , reload your world! SIMPLE AND GENIUS:D
    Primus likes this.
  3. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    eeeeheeheheh wtf your q.i?
  4. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Personally I didn't catch that. Please talk clearly so everyone could understand.
    @Flabe idea + teleport players to your lobby before that.
  5. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    i use that
    public function reset() {//tp everybody to another world temporary$this->getServer()->loadLevel("Redirect");
    foreach($this->getServer()->getOnlinePlayers() as $p){$p->getInventory()->clearAll();$p->teleport($this->getServer()->getLevelByName("Redirect")->getSafeSpawn());
    }//replace world$this->getServer()->unloadLevel($this->getServer()->getLevelByName("WorldToReset"));$path = $this->getServer()->getDataPath();$this->recurse_copy($path."worlds/WorldBackup",$path."worlds/WorldToReset");$this->getServer()->loadLevel("WorldToReset");//tp everybody back to the worldforeach($this->getServer()->getOnlinePlayers() as $p){$p->teleport($this->getServer()->getLevelByName("WorldToReset")->getSafeSpawn());
    }
    }

    public function recurse_copy($src,$dst) {$dir = opendir($src);
    @mkdir($dst);
    while(false !== ( $file = readdir($dir)) ) {
    if (( $file != '.' ) && ( $file != '..' )) {
    if ( is_dir($src . '/' . $file) ) {$this->recurse_copy($src . '/' . $file,$dst . '/' . $file);
    }
    else {copy($src . '/' . $file,$dst . '/' . $file);
    }
    }
    }closedir($dir);
    }
  6. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    I'll notice you that nobody will read it until it hasn't "[ PHP ]" tags :p
  7. Marcelo234
    Offline

    Marcelo234 New Member

    Joined:
    Oct 18, 2014
    Posts:
    204
    Look a YouTube...There is a guy called Joseper....He made a WorldReset Plugin....You can download it there. If you want to have an Example...
  8. andre_the_gamer
    Offline

    andre_the_gamer Active Member

    Joined:
    Feb 5, 2015
    Posts:
    112
    Minecraft User:
    Andre_The_Gamer
    Like @Flabe stated hi's way is simple and easy to understand..

    But again if you didn't understand i'll explain.

    1. Turn-off-auto-saves
    2. After match is completed teleport the player to a temp world then unload the arena world then load it again
  9. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7

Share This Page

Advertisement