13
0
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-04-15 12:53:43 +02:00
Ursprung 083936434a
Commit 6d86a32b49

Datei anzeigen

@ -18,14 +18,14 @@ import java.io.IOException;
class WorldEdit_14 { class WorldEdit_14 {
private WorldEdit_14(){} private WorldEdit_14(){}
static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException { static EditSession pasteSchematic(Player player, Schematic schematic) throws IOException, NoClipboardException {
World weWorld = new BukkitWorld(player.getWorld()); World weWorld = new BukkitWorld(player.getWorld());
Location playerLocation = player.getLocation(); Location playerLocation = player.getLocation();
Clipboard clipboard = schematic.load(); Clipboard clipboard = schematic.load();
BlockVector3 vector = BlockVector3.at(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ()); BlockVector3 vector = BlockVector3.at(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ());
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()); BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
BlockVector3 dimensions = clipboard.getDimensions(); BlockVector3 dimensions = clipboard.getDimensions();
BlockVector3 v = vector.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()).subtract(offset); BlockVector3 v = vector.subtract(dimensions.getX()/2, 0, dimensions.getZ()).subtract(offset);
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1); EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1);
Operations.completeBlindly(new ClipboardHolder(clipboard).createPaste(e).to(v).build()); Operations.completeBlindly(new ClipboardHolder(clipboard).createPaste(e).to(v).build());
e.flushSession(); e.flushSession();