Content generated with AI — it may contain mistakes.

Gameplay

Regions, schematics and worlds

Areas of the world, saving and pasting boxes of it, and creating worlds from any thread.

Regions

An area of the world with rules attached, indexed so asking what is at a location is cheap.

PluginRegions regions = Regions.of(this);
 
List<RegionSnapshot> here = Regions.at(player.getLocation());
ConceptWhat it is
ShapeCuboid or sphere, in one world.
SnapshotAn immutable view of a region as it is now.
PolicyWhat happens where regions overlap.
EventsEnter and exit, raised as players move.

The index is immutable and rebuilt on change rather than mutated, so a lookup never sees a half-written region and never needs a lock.

Regions.resolve(location, policy) is the one to reach for when two regions overlap and only one answer makes sense: the policy decides which wins rather than each caller inventing a rule.

The module also draws outlines — the particle box every arena editor uses — and handles selection with the shared wand.

Schematics

Saving a box of the world and pasting it back, over FastAsyncWorldEdit:

PluginSchematics schematics = Schematics.of(this);
 
schematics.save("arena_main", min, max);
schematics.regenerate("arena_main", cuboid, worldId);
schematics.paste("arena_main", location);
schematics.exists("arena_main");

It is what regenerates an arena between matches, with its chests still full. Every call is a future, and the work happens off the main thread.

Check isSupported

Schematics.isSupported() is false without FastAsyncWorldEdit, and unsupportedReason() is a string you can print. Every call then does nothing rather than throwing — which is worth handling, because an arena that silently did not regenerate looks like a plugin bug.

Worlds

Creating and deleting worlds through the Worlds plugin, from any thread:

Worlds.create(Key.key("myplugin", "arena"), "arena_1")
      .thenAccept(world -> paste(world));
 
Worlds.delete(world);

Worlds.isAvailable() says whether anything can be created at all, and backendName() names what is doing it.

On Folia this is the only way: Bukkit's own world creation is not available there. Without the Worlds plugin the module does nothing loudly, and the caller finds out from the future rather than from an exception in the middle of a startup sequence.

Something missing on this page? Tell us on Discord