A simple and lightweight library for pasting and undoing Minecraft schematics using WorldEdit/FAWE.
- ✅ Easy schematic pasting by name
- ✅ Automatic schematic loading from plugin's schematics folder
- ✅ Synchronous and asynchronous operations
- ✅ Built-in undo functionality
- ✅ Auto-remove feature with delay
- Spigot/Paper 1.13+
- Java 17+
<repository>
<id>endchest-releases</id>
<url>https://repo.endchest.ru/releases</url>
</repository>
<dependency>
<groupId>me.seetch</groupId>
<artifactId>schematiclib</artifactId>
<version>1.0.1</version>
</dependency>maven {
url "https://repo.endchest.ru/releases
}
implementation 'me.seetch:schematiclib:1.0.1'Download the JAR file from Releases and add it to your project.
public class MyPlugin extends JavaPlugin {
private SchematicLib schematicLib;
@Override
public void onEnable() {
schematicLib = new SchematicLib(this);
}
}// Paste schematic
Location location = player.getLocation();
schematicLib.paste("house.schem", location);
// Undo paste
schematicLib.undo(location);// Async paste with callback
schematicLib.pasteAsync("house.schem", location)
.thenRun(() -> {
// Success
})
.exceptionally(error -> {
// Handle error
return null;
});
// Async undo
schematicLib.undoAsync(location);// Paste and automatically remove after 200 ticks (10 seconds)
schematicLib.pasteAndAutoRemove("house.schem", location, 200L);schematicLib.pasteAndAutoRemove("house.schem", location, 200L, (error) -> {
player.sendMessage("Failed to paste schematic: " + error.getMessage());
});Place your schematic files in: plugins/YourPlugin/schematics/
Supported formats:
- .schem
- .schematic
public class SchematicCommand implements CommandExecutor {
private final SchematicLib manager;
public SchematicCommand(SchematicLib manager) {
this.manager = manager;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player player)) {
sender.sendMessage("Player only command!");
return true;
}
if (args.length < 1) {
sender.sendMessage("/pasteschem <schematic_name>");
return true;
}
String schematicName = args[0];
Location location = player.getLocation();
manager.pasteAndAutoRemove(schematicName, location, 200L, (error) -> {
player.sendMessage("Error: " + error.getMessage());
}).thenRun(() -> {
player.sendMessage("Schematic pasted! Will be removed in 10 seconds.");
});
return true;
}
}- void paste(String schematicName, Location location)
- CompletableFuture<Void> pasteAsync(String schematicName, Location location)
- CompletableFuture<Void> pasteAsync(String schematicName, Location location, Consumer<Exception> onError)
- void undo(Location location)
- CompletableFuture<Void> undoAsync(Location location)
- CompletableFuture<Void> undoAsync(Location location, Consumer<Exception> onError)
- CompletableFuture<Void> pasteAndAutoRemove(String schematicName, Location location, long delayTicks)
- CompletableFuture<Void> pasteAndAutoRemove(String schematicName, Location location, long delayTicks, Consumer<Exception> onError)
This project is licensed under the MIT License - see the LICENSE file for details.
If you have questions or suggestions, create an Issue on GitHub.