From fcf02df4dcf76d55493851b7328c72dc165d5fc6 Mon Sep 17 00:00:00 2001 From: sk89q Date: Thu, 14 Oct 2010 23:39:07 -0700 Subject: [PATCH] Added /editcut. --- src/WorldEdit.java | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/WorldEdit.java b/src/WorldEdit.java index 858a33fc0..152942ffa 100644 --- a/src/WorldEdit.java +++ b/src/WorldEdit.java @@ -127,6 +127,7 @@ public class WorldEdit { commands.put("/removeabove", " - Remove blocks above head"); commands.put("/removebelow", " - Remove blocks below position"); commands.put("/editcopy", "Copies the currently selected region"); + commands.put("/editcut", "Cuts the currently selected region"); commands.put("/editpaste", "Pastes the clipboard"); commands.put("/editpasteair", "Pastes the clipboard (with air)"); commands.put("/editstack", " - Stacks the selection"); @@ -540,8 +541,20 @@ public class WorldEdit { return true; // Copy - } else if (split[0].equalsIgnoreCase("/editcopy")) { - checkArgs(split, 0, 0, split[0]); + } else if (split[0].equalsIgnoreCase("/editcopy") + || split[0].equalsIgnoreCase("/editcut")) { + boolean cut = split[0].equalsIgnoreCase("/editcut"); + BaseBlock block = new BaseBlock(0); + + if (cut) { + checkArgs(split, 0, 1, split[0]); + if (split.length > 1) { + getBlock(split[1]); + } + } else { + checkArgs(split, 0, 0, split[0]); + } + Region region = session.getRegion(); Vector min = region.getMinimumPoint(); Vector max = region.getMaximumPoint(); @@ -552,8 +565,13 @@ public class WorldEdit { min, min.subtract(pos)); clipboard.copy(editSession); session.setClipboard(clipboard); - - player.print("Block(s) copied."); + + if (cut) { + editSession.setBlocks(session.getRegion(), block); + player.print("Block(s) cut."); + } else { + player.print("Block(s) copied."); + } return true;