Wrappers & Core API
WorldEdit v7 introduced massive breaking changes over WorldEdit v6—renaming classes, altering packages, changing vector data types, and modifying method signatures across core objects.
MultiWorldEdit isolates these breaking changes behind version-agnostic Wrappers. This allows your plugin to interact with a single unified API while MultiWorldEdit resolves the underlying WorldEdit calls under the hood.
The Escape Hatch: #to()
Section titled “The Escape Hatch: #to()”Every wrapper exposes a #to() method. If you ever need to access the native, underlying WorldEdit object directly for advanced operations, you can unwrap it instantly:
// Get the wrapperClipboardWrapper wrapper = ...;
// Unwrap to get the native WorldEdit Clipboard objectClipboard nativeClipboard = wrapper.to();Available Wrappers
Section titled “Available Wrappers”VectorWrapper
Section titled “VectorWrapper”Abstracts vector operations between legacy WorldEdit Vector instances (v6) and modern BlockVector3 / Vector3 representations (v7). Use it to construct or transform coordinates safely across versions.
- Unwrap: Call
.to()to retrieve the native underlying vector instance.
ClipboardWrapper
Section titled “ClipboardWrapper”Standardizes vector operations on loaded schematic clipboards, shielding you from API differences when fetching origin points and region boundaries.
- Key Methods:
getOrigin(),getMinimumPoint(),getMaximumPoint(),getRegion(). - Unwrap: Call
.to()to retrieve the native version-specificClipboardinstance.
RegionWrapper
Section titled “RegionWrapper”Bridges vector type differences when querying region boundaries across WorldEdit versions.
- Key Methods:
getMinimumPoint()andgetMaximumPoint()both return a unifiedVectorWrapperregardless of whether WorldEdit is returning a v6Vectoror v7BlockVector3. - Unwrap: Call
.to()to retrieve the nativeRegioninstance.
EditSessionWrapper
Section titled “EditSessionWrapper”Handles critical lifetime and closing differences in EditSession.
try (EditSessionWrapper wrapper = MultiWorldEdit.getInstance().create(world, maxBlocks)) { // Perform block changes safely} // Automatically flushes on v7, safely no-ops cleanup on v6- Unwrap: Call
.to()to retrieve the nativeEditSessioninstance.
PasteBuilderWrapper
Section titled “PasteBuilderWrapper”Provides a fluent builder pattern to configure schematic pastes (controlling air block placement, rotation, and target locations) and executes them across v6 and v7 without version-specific reflection.
Accessing Wrappers
Section titled “Accessing Wrappers”All wrapper instances are created via the main MultiWorldEdit entry point:
MultiWorldEdit instance = MultiWorldEdit.getInstance();
// Access individual wrappers/factoriesClipboardWrapper clipboardWrapper = instance.create(clipboard, editSession, world);RegionWrapper regionWrapper = instance.create(nativeRegion);