Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TemplateWorld is a plugin to make it able to create a runtime-only world based on a 'template world'

License

Notifications You must be signed in to change notification settings

AllayMC/TemplateWorld

Repository files navigation

๐ŸŒ TemplateWorld

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. ๐ŸŽฎ

โœจ Features

  • ๐Ÿ—บ๏ธ 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

๐Ÿ“ฅ Installation

  1. ๐Ÿ“ฆ Download the latest release from Releases
  2. ๐Ÿ“‚ Place the JAR file in your server's plugins folder
  3. ๐Ÿš€ Start the server

๐ŸŽฏ Usage

๐Ÿ“ Preparing Templates

  1. Create a folder named templates in your server root directory
  2. Copy your world folder into templates/
  3. The folder name will be used as the template name
server/
โ”œโ”€โ”€ templates/
โ”‚ โ”œโ”€โ”€ lobby/
โ”‚ โ”œโ”€โ”€ bedwars_map1/
โ”‚ โ””โ”€โ”€ skywars_map1/
โ””โ”€โ”€ ...

๐Ÿ’ป Commands

Command Description Permission
/template create <template_name> Create a temporary world from a template templateworld.command

๐Ÿ”ง API Usage

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

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

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
);

โš™๏ธ How It Works

  1. ๐Ÿ“‚ Template worlds are stored in the templates/ directory
  2. ๐Ÿ“– When a world is created, chunks are read from the template but written to a separate storage location
  3. ๐Ÿ’จ Temporary worlds: written to worlds/.tmp/, each gets a unique UUID as its name, and are marked as runtimeOnly
  4. ๐Ÿ’พ 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
  5. ๐Ÿ”„ On server restart, all temporary world files are automatically cleaned up, while persistent worlds retain their data

๐Ÿ“„ License

This project is licensed under the LGPL v3 License - see the LICENSE file for details.

About

TemplateWorld is a plugin to make it able to create a runtime-only world based on a 'template world'

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

AltStyle ใซใ‚ˆใฃใฆๅค‰ๆ›ใ•ใ‚ŒใŸใƒšใƒผใ‚ธ (->ใ‚ชใƒชใ‚ธใƒŠใƒซ) /