I am using WE API to paste a .schem file in a world, and when the code is run, nothing happens. No errors are thrown, the blocks just don't get pasted.
The schematic file exists and the location exists.
Version 1.21.4, worldedit api 7.3.9
The schematic file exists and the location exists.
Version 1.21.4, worldedit api 7.3.9
Java:
public static void paste(Location location, File schematicFile) {
if (!schematicFile.exists()) {
DebugUtil.severe("Schematic File " + schematicFile.getName() + " doesn't exist.");
return;
}
try {
EditSession session = WorldEdit.getInstance().newEditSession(new BukkitWorld(location.getWorld()));
ClipboardFormat format = ClipboardFormats.findByFile(schematicFile);
if (format == null) {
DebugUtil.severe("Clipboard format for schematic File " + schematicFile.getName() + " doesn't exist.");
return;
}
ClipboardReader reader = format.getReader(new FileInputStream(schematicFile));
Clipboard schematic = reader.read();
Operation operation = new ClipboardHolder(schematic)
.createPaste(session)
.to(BukkitAdapter.asBlockVector(location))
.build();
Operations.complete(operation);
} catch (IOException | WorldEditException e) {
e.printStackTrace();
}
}