Solved What is the best way to reset a mini game world?

Discussion in 'Plugin Development' started by DennisUnplugged, Jan 9, 2021.

  1. Offline

    DennisUnplugged

    I'm basically coding a PvP mini game and it was going perfectly since I realized that my server would crash every time I'd reset the map. In this project I decided to use WorldEdit since it was easy to use (Save and load regions, change their blocks and stuff like that) BUT when it comes to looping throw a massive of 80.000 blocks and changing them to reset the map it just became USELESS because MY SERVER CRASHED. SO WHAT IS THE BEST WAY TO RESET A MINI GAME WORLD except from world edit.

    Further Explanation:

    Players would be able to modify specific blocks in game and I just want to reset them when the game ends nothing more!

    Main question:

    WORLD EDIT ALTERNATIVES!?
     
  2. Offline

    FRO5TBITE

    So I'm still new myself, but maybe consider putting a world in the filesystem, and on the instance of the minigame's specific constructor, you would make a copy of this world with the specific name and put the player on it. At the end of the minigame you would remove all of the entities and such, and then delete the world. I feel like using world edit for this would be a bit overkill because the way it sounds like you're doing it is even more complicated than using a schematic.

    Let me know if you try it this way, and if you do, how it goes. :)
    Again I'm still learning so if anyone sees this and gets repulsed, feel free to correct me.
     
  3. Offline

    ForbiddenSoul

    80,000 blocks is pretty much nothing. If you actually only have 80,000 blocks there is some hiccup with your code.
    For example 64 x 64 x 64 is 262,144 blocks (1/4 million).
    I have a hunch that your world is much larger than that though.
    At any rate, you can look up how to turn off auto save for the world once you have it set up the way you want.
    Once the game is over, just reload it, nothing got saved, and you will have your fresh new one all over again.
     
  4. Offline

    DennisUnplugged

    Ok so I basically decided to use world edit for a specific part of the map and then I used an array to store the broken blocks so I could rollback them at the end.
     

Share This Page