TemplateWorld is an AllayMC plugin that allows you to create worlds based on template worlds. It supports both temporary (runtime-only) and persistent worlds, making it ideal for mini-game servers, lobby systems, and any scenario where you need to create worlds from pre-defined templates. ๐ฎ
- ๐บ๏ธ Create temporary or persistent worlds from pre-defined templates
- ๐จ Temporary worlds are runtime-only and won't persist to disk
- ๐พ Persistent worlds preserve modifications using copy-on-write storage
- ๐ฆ Support for different world storage formats (LEVELDB, etc.)
- ๐งน Automatic cleanup of temporary world files on server restart
- ๐ Simple API for programmatic world creation
- ๐ฆ Download the latest release from Releases
- ๐ Place the JAR file in your server's
pluginsfolder - ๐ Start the server
- Create a folder named
templatesin your server root directory - Copy your world folder into
templates/ - The folder name will be used as the template name
server/
โโโ templates/
โ โโโ lobby/
โ โโโ bedwars_map1/
โ โโโ skywars_map1/
โโโ ...
| Command | Description | Permission |
|---|---|---|
/template create <template_name> |
Create a temporary world from a template | templateworld.command |
First, you should add the dependency to your project:
repositories {
mavenCentral()
}
dependencies {
compileOnly(group = "org.allaymc", name = "template-world", version = "0.1.0")
}Temporary worlds are runtime-only โ they get a random UUID as their name and are automatically cleaned up when unloaded or on server restart.
import org.allaymc.templateworld.TemplateWorld; import org.allaymc.api.world.World; // Create a temporary world using default LEVELDB format World tmpWorld = TemplateWorld.createTmpWorld("bedwars_map1"); // Create with custom formats World tmpWorld = TemplateWorld.createTmpWorld( "bedwars_map1", // template name "LEVELDB", // template format "LEVELDB" // temporary world format );
Persistent worlds are not runtime-only โ their modifications are preserved across chunk unloads. Reads check the persistent storage first, then fall back to the template for unmodified chunks.
import org.allaymc.templateworld.TemplateWorld; import org.allaymc.api.world.World; // Create a persistent world using default LEVELDB format World world = TemplateWorld.createPersistentWorld( "bedwars_map1", // template name "my_game_room" // persistent world name ); // Create with custom formats World world = TemplateWorld.createPersistentWorld( "bedwars_map1", // template name "LEVELDB", // template format "my_game_room", // persistent world name "LEVELDB" // persistent world format );
- ๐ Template worlds are stored in the
templates/directory - ๐ When a world is created, chunks are read from the template but written to a separate storage location
- ๐จ Temporary worlds: written to
worlds/.tmp/, each gets a unique UUID as its name, and are marked asruntimeOnly - ๐พ Persistent worlds: written to
worlds/<worldName>/, modifications are preserved via copy-on-write โ unmodified chunks are read from the template, modified chunks are read from the persistent storage - ๐ On server restart, all temporary world files are automatically cleaned up, while persistent worlds retain their data
This project is licensed under the LGPL v3 License - see the LICENSE file for details.