From b73db47e01791f069a9414f85d131c533be01965 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Mon, 27 Sep 2021 14:15:26 +0100 Subject: [PATCH] Add switch to schem loadall to replace existing clipboard(s) --- .../sk89q/worldedit/command/SchematicCommands.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index 784a37063..ae80c4e5a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -153,8 +153,10 @@ public class SchematicCommands { String formatName, @Arg(desc = "File name.") String filename, - @Switch(name = 'r', desc = "Apply random rotation") - boolean randomRotate + @Switch(name = 'o', desc = "Overwrite/replace existing clipboard(s)") + boolean overwrite +// @Switch(name = 'r', desc = "Apply random rotation") <- not implemented below. +// boolean randomRotate ) throws FilenameException { final ClipboardFormat format = ClipboardFormats.findByAlias(formatName); if (format == null) { @@ -164,7 +166,11 @@ public class SchematicCommands { try { MultiClipboardHolder all = ClipboardFormats.loadAllFromInput(player, filename, null, true); if (all != null) { - session.addClipboard(all); + if (overwrite) { + session.setClipboard(all); + } else { + session.addClipboard(all); + } player.print(Caption.of("fawe.worldedit.schematic.schematic.loaded", filename)); } } catch (IOException e) {