1.16.5 How to load schematic with world-edit API

Discussion in 'Spigot Plugin Development' started by w0982133, Jul 9, 2021.

  1. Does anyone know how to use world-edit API to load Schematic? I can't understand the API Examples of world-edit's website
     
  2. Loading:
    Code (Java):
    ClipboardFormat format = ClipboardFormats.findByFile(file);
    try (ClipboardReader reader = format.getReader(new FileInputStream(file))) {
       Clipboard clipboard = reader.read();
    }[
    Pasting:

    Code (Java):
    try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1)) {
        Operation operation = new ClipboardHolder(clipboard)
                .createPaste(editSession)
                .to(BlockVector3.at(x, y, z))
                .ignoreAirBlocks(false)
                .build();
        Operations.complete(operation);
    }
     
    • Useful Useful x 1