hello guys I wanted to know how to charge my world once the game is over I'm trying to make a plugin SkyWars
Personally I didn't catch that. Please talk clearly so everyone could understand. @Flabe idea + teleport players to your lobby before that.
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); }
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...
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