How to unload world without save?

How to do that for minigame ?

World world;
world.getSerializationBehavior(SerializationBehaviors.NONE); //this means the world will not save
1 Like

Thank you ,i will try it soon, I just do cancel SaveWorldEvent, but didn’t work

1 Like

Thank you ,it’s work, but some thing need notice , when i set world.setSerializationBehavior(SerializationBehaviors.NONE) at GameStartedServerEvent only once, it’s not work, Must set before unloadWorld() everytime.

Ah. Try setting it on worldProperties as those are the settings that get saved into the file while setting it directly into the world only apply for that time it is loaded.

1 Like

I guess my question is what aren’t you trying to save here? Could a possible solution be to just recopy the region files to the folder after you unload it?

1 Like

You inspire me, i just wonder why “world.getProperties().setGameRule(“doMobSpawning”, “false”)” not work, because i set SerializationBehavior to none, when world unload automatic the gamerule didn’t save, So, i set SerializationBehavior to manual and save world after setGameRule.

world.getProperties().setGameRule("doMobSpawning", "false");
world.getProperties().setGameRule("doMobLoot", "true");;

I was made some minigame, I want wither have break block ability, And when gameover, the world will reload without save broken map. The recopy absoluly can be a solution.

Personally never touched gamerules. Try using this.

It’s a enum class ,With it, i don’t need check spelling problems over and over…Thank you ~~