1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Level::setAutoSave()

Discussion in 'Development' started by SavionLegendZzz, Nov 5, 2018.

  1. SavionLegendZzz

    SavionLegendZzz Slime

    Messages:
    75
    GitHub:
    savionlegends
    I am trying to find a better way for "resetting" a world instead of backing up the folder deleting the level i need to reset and moving the backup back to the worlds/ folder. Would Level::setAutoSave(false) work as an alternative ?
     
  2. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    Yep the result would be the same, though you need to unload and load the level for it to "reset"
     
  3. SavionLegendZzz

    SavionLegendZzz Slime

    Messages:
    75
    GitHub:
    savionlegends
    Do i set the autoSave before after or during i load the level or when i unload it?
     
  4. SkySeven

    SkySeven Baby Zombie

    Messages:
    145
    GitHub:
    SkySevenMC
    Before the game start use Level::setAutoSave(false) when it finish unload the level.
     
  5. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    Level->setAutoSave(bool $bool); sets that in level is saving updates eg. block places, breaks, etc. If you want use this method for resetting map, first save level Level->save() and for reset it unload and load again. This method does not creates zip files, it's only cancel saving level. If you want save world using zip file, look to my SkyWars plugin.
     
  6. SkySeven

    SkySeven Baby Zombie

    Messages:
    145
    GitHub:
    SkySevenMC
    Why did you use Zip files, it's work with Level::setAutoSave(false), zip is not necessary here
     
  7. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    Because it's more safer. When I used Level->setAutoSave, some peoples said that it does not work. So I decided to try resetting using zip.
     
  8. SkySeven

    SkySeven Baby Zombie

    Messages:
    145
    GitHub:
    SkySevenMC
    I use Level ::SetAutoSave(false) since 2 years and I have never encountered any problems but I agree, it's less safer.
     
  9. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    In what way is calling Level::setAutoSave() less safer? And compared with what is it less safer?
     
  10. SkySeven

    SkySeven Baby Zombie

    Messages:
    145
    GitHub:
    SkySevenMC
    I don't know why I said that.I'm not English, I do not express myself correctly.
     
  11. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    It is not safe. It does not always for me.
     
  12. SkySeven

    SkySeven Baby Zombie

    Messages:
    145
    GitHub:
    SkySevenMC
    Compared with reset with a Zip file
     
  13. SkySeven

    SkySeven Baby Zombie

    Messages:
    145
    GitHub:
    SkySevenMC
    Why ?
     
  14. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    After you load the level, or simply set auto-save=off in server.properties
     
  15. SkySeven

    SkySeven Baby Zombie

    Messages:
    145
    GitHub:
    SkySevenMC
    But if you set auto-save=off in server.properties it's set for all the world.
     
  16. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    Because 1/5 times it does not reset.
     
  17. SkySeven

    SkySeven Baby Zombie

    Messages:
    145
    GitHub:
    SkySevenMC
    It's always work for me :)
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.