Better world saving control & optimizations

This commit is contained in:
Govindas 2021-06-21 10:07:29 +00:00
parent f71148c0eb
commit f4561a7535

View File

@ -6,13 +6,18 @@ options:
ResetResettableWorldsOnRestart: true
AutoDeleteClonesOnRestart: true
#whether it should only reset "region" world folder contents and not other things like level.dat (It's cheaper to reset only region folder, but it doesn't reset world metadata, only the chunks, which may be not what you wish)
ResetOnlyRegionFolder: false
ResetOnlyRegionFolder: true
#whether /fwr create will look for existing world folder or allow to create a new blank one.
#Creating blank world will not function for resetting (as there will be no template) until you update template by running /fwr create on the same world again.
#useful for when you want to copypaste a map into a newly created world and then make it resettable
#without having to go through another world management plugin to do it
AllowCreatingNewWorlds: true
#by default saving is only disabled in chunk-based reset worlds, not world-based reset ones.
#this option disables world saving in all resettable worlds
DisableSavingInAllResettableWorlds: false
#------------- End of Configuration -------------
#The script starts here, only edit if you know what you are doing.
@ -735,9 +740,10 @@ function initWorlds():
if {@ResetResettableWorldsOnRestart} is true:
make console execute command "/fastworldreset reset %loop-value%"
else if loop-value parsed as a world is not a world:
else if (loop-value parsed as a world) is not a world:
loadWorld(loop-value)
function deleteClones():
{fastworldresetclone::*} is set
set {_worlddir} to {-fwrcache::worlddir}
create section stored in {_section}:
loop {fastworldresetclone::*}:
@ -771,7 +777,17 @@ on world init:
else:
set {_options} to "%event-world%"
{-fastworldresetworld::%{_options}%} is set
#reduces ram usage by disabling spawn chunks
event-world.setKeepSpawnInMemory(false)
{fastworldreset::chunkresetdisabled::%{_options}%} is not set:
set {_disablesaving} to true
else if {@DisableSavingInAllResettableWorlds} is true:
set {_disablesaving} to true
{_disablesaving} is set:
event-world.setAutoSave(false)
#for Paper servers, to disable saving
@ -782,11 +798,7 @@ on world init:
set {_config}.autoSavePeriod to 0
set {_config}.maxAutoSaveChunksPerTick to 0
#in the past I thought this is needed, now I am not sure as I haven't noticed a difference, but I'll keep it here, just in case, it sounds logical to disable it for chunk-based reset
set {_config}.skipEntityTickingInChunksScheduledForUnload to false
event-world.setKeepSpawnInMemory(false)
on world saving:
{fastworldreset::chunkresetdisabled::%event-world%} is not set
set {-fastworldreset::shouldreset::%event-world%} to true