With this script you can reset your worlds easily without the need of restarting server and without lag! This is made for both environments, survival and minigames. This is capable of resetting 10s of minigame worlds simultaneously without lag for your players!
If you ever find it too slow, just contact me and I'll see what we can do, but I highly doubt that it'd ever be too slow.
How it works
There are two reset modes, one that is stabler, but slower and other is faster, but will fall back to stabler one if it fails
Chunk-based reset system (Only works in 1.8-1.12.2 version of Minecraft):
- The fastest reset system, it works by disabling world saving and just re-loading the chunks to reset them, it doesn't do any block changes, so it's the fastest reset system available. If your server fails to prevent world save, it will fall back to world-based reset. This system uses Paper API to ensure that the world does not save, however it still works with Spigot, just may not prevent world saves that well. Paper is recommended. NOTE: this is only good for short-lived worlds, like minigames, as it disables chunk unloading. (only unloads them on reset)
Chunk-based reset is enabled by default on 1.8-1.12.2 you can disable it with /fwr disable-chunk-reset <world>
World-based reset system (Works in all versions of Minecraft):
- It simply creates a copy of the world and when resetting, unloads the world, copies its "region" folder data and loads the world back. If you're needing to reset a survival world that you want to persist between restarts and only reset at command, it is recommended to disable chunk-based reset and just use this. It is well optimized and should reset faster than other world-based reset systems as it disables various useless world load tasks that other world management plugins do. World-based reset is enabled by default on 1.13+
Dependencies
Skript (2.6+)
skript-reflect (2.2.3+)
Optional
GovindaSK (used to reduce use of skript-reflect in performance-heavy situations, to reset your worlds faster! Automatically falls back to unloading chunks with skript-reflect if GovindaSK isn't found, throws 2 errors that can be safely ignored. The speed difference is only visible in huge world resetting.)
(Only useful in 1.8 - 1.12.2)
Installation
Simply put
fastworldreset.sk into your plugins/Skript/scripts folder, then open it and take a look at configuration if you need to change anything.(some setups will need to edit config for this script to function)
It is recommended to configure your database in config.sk to not save variables starting with '-' character! Huge performance boost! And some features may not work right if you don't configure that.
WARNING: Make sure no other world management plugin is managing a FastWorldReset world for maximum speed.
And make sure that you're using Linux, because Windows/Mac OS will lag a lot more when resetting
Usage(All commands need OP or fastworldreset.use permission)
Aliases:
/fastworldreset
/fwr create <world> [generator] - Add a world to FastWorldReset system or create a completely new world into the system. (Or update existing world's template)
/fwr delete <world> - Removes the world from FastWorldReset system, does not unload or delete the world.
/fwr clone <world> <new-world> - Clones a FWR world.
/fwr reset <world> - to reset a world. (Must be in FastWorldReset system)
/fwr exit - sets exit point to where players get teleported when their world resets.
/fwr load <world> [generator] - loads a world. Optionally with a generator.
/fwr unload <world> [<true/false>] - loads a world. true/false if the world should be saved, defaults to true.
/fwr unload-chunks <world> <true/false> - unloads chunks in the specified world, with saving or without.
/fwr tp <world> [player] - teleport to a world or teleport another player to the world.
/fwr disable-chunk-reset <world> - disables chunk-based resetting of the specified world, which makes the chunks unload normally. May be useful in situations where the world uses very much RAM and you prefer slower reset than higher RAM usage.
/fwr enable-chunk-reset <world> - enables chunk-based reset, this is enabled by default for fastest speed, see above to disable. (This is only meant for things like minigame maps, not where you need changes to persist across server restarts!)
/fwr worlds - shows the list of all worlds and their data.
/fwr generator <world> <generator> - set a generator for a world.
/fwr generators - list all world generators detected on the server.
/fwr info <world> - see information about the specified world.
/fwr resetstats - useful for debugging of reset bugs.
/fwr optimize-template <world> - useful for removing unneeded files from a world reset template.
also this script comes with a little API to be used in your scripts:
you can tell when world starts to reset in any of your scripts with use of these events:
Code (Text):
on start of world reset:
broadcast "%event-world% is starting to reset!"
then to know when the reset has finished, you use this event:
Code (Text):
on complete of world reset:
broadcast "%event-world% has completed resetting!"
the on complete of world reset event happens when the world has absolutely finished resetting and is available to be used for anything you wish
Support
You can receive support by creating an issue at the
git repository, alternatively you can receive live chat support in my
Matrix chatroom.