What method do you use to restore the level after a minigame was played? I am disappointed of my current one because it doesnt work properly... Can you show me yours?
Which one do you use? Also, do you have everything in one world? Or is the world completely empty after the game?
Well no it wasnt reset. It mostly works, but sometimes I feel like it doesnt. I use the way where you delete and replace the folder.
Im using this: PHP: copy($this->getServer()->getDataPath().'copyworld/world/region/r.-1.0.mcr',$this->getServer()->getDataPath().'worlds/world/region/r.-1.0.mcr');
You cannot copy the entire folder, you must copy recursively. copy() can only handle single files. I found a very good example demonstrating how you can achieve that on StackOverflow.
I didn't tell him to copy the whole folder with copy(). I am using an own function as well in my old plugins.
Your post suggested otherwise. You should've said "recursively copy" instead of "copy the entire folder". @Ragnok1234 You shouldn't use the code you're using right now, because it's very inefficient. You should utilize loops and recursively copy the entire directory instead.
"Copy" doesn't mean only specific files. I can copy the entire folder, and I can copy only one file. I never said anything about "copy the folder with your current code/copy()".
I know. But since minigame levels use about 1 mcr file except on BedWars or SurvivalGames this method is useful.
Thats the way I use, but I think the problem is my minigame code which returns a "" as levelname :/ I am looking for a faster and easier function too. I have heard once that turning auto save off and reloading the level should reset it, is that true?
I used that method previously. It works, but is slower and it actually does lag the server, even if you don't feel it. setAutoSave does not.