#Regenerating griefed chunks after specific period of time

1 messages · Page 1 of 1 (latest)

slate trellis
#

What would be the best way to make the world regenerate itself automatically after 1 week while also keeping claimed chunks? Do i need to track every block placement/break and its date and then have one scheduled task to loop through all chunks that were last interacted with more than 1 week ago or is there a better solution? And how performance intensive would that be?

fair sorrel
#

You could in theory regen the chunk from the world generator

#

So you don’t have to track anything

slate trellis
#

ive never done anything with world generators

quick edge
#

isn't there just a method regenerateChunk() or sth?

fair sorrel
#

Worldedit might have api for it

fair sorrel
#

Could be wrong

steep frost
#

Copy claimed chunks into new world folder and generate new world with same seed 🙂

slate trellis
steep frost
#

Ah

fair sorrel
#

You’d have to track when the chunk was first modified

#

And then wait a week

slate trellis
quick edge
fair sorrel
#

Hmm, well you can try it

slate trellis
#

and does the server lag when regenerating a chunk?

fair sorrel
#

Most of its off the main thread these days

#

But it’s still not a trivial operation

steep frost
#

PS: Use a queue filled with simple
records for tracking.

{
  restoreTime: long
  chunkX: int
  chunkZ: int
}

Every chunk is regenerated in order. So if the highest track in the queue doesnt need regeneration, then you dont need to check any of the others. This way you can very efficiently poll the queue from the top.

slate trellis
#

wow thats smart

#

so tracking block changes and restoreTime is the best solution right?

fair sorrel
#

If you do the entire chunk you just need to track the first change

#

Or the last depending on what you want

#

But if you can’t regen the entire chunk you’d have to track everything

steep frost
#

Should probably have some sort of hash collection like a HashSet or HashMap to check if a chunk is allready tracked in O(1)

#

The tricky part is consistently regenerating the chunk in a way that performs well

slate trellis
#

the idea of the plugin is to have ChunkClaims that are protected and will never reset. Everything unclaimed will be reset after 1 week of inactivity

#

and survival

fair sorrel
#

Generally you just do a resource world for this

slate trellis
#

and then copy each block one by one over?

steep frost
#

Hm if your world has a big size then you should probably generate chunks lazily. Meaning if a chunk is due for regeneration, then simply move it
from the queue into a set. Then on chunk load, check if the loaded chunk is one that is in this set (and due for regeneration).

You dont want your server to randomly load tons of chunks in the farlands just to regenerate them.

slate trellis
#

thats so flippin smart