Added /editcut.

Dieser Commit ist enthalten in:
sk89q 2010-10-14 23:39:07 -07:00
Ursprung 9dc324f00a
Commit fcf02df4dc

Datei anzeigen

@ -127,6 +127,7 @@ public class WorldEdit {
commands.put("/removeabove", "<Size> <Height> - Remove blocks above head"); commands.put("/removeabove", "<Size> <Height> - Remove blocks above head");
commands.put("/removebelow", "<Size> <Height> - Remove blocks below position"); commands.put("/removebelow", "<Size> <Height> - Remove blocks below position");
commands.put("/editcopy", "Copies the currently selected region"); commands.put("/editcopy", "Copies the currently selected region");
commands.put("/editcut", "Cuts the currently selected region");
commands.put("/editpaste", "Pastes the clipboard"); commands.put("/editpaste", "Pastes the clipboard");
commands.put("/editpasteair", "Pastes the clipboard (with air)"); commands.put("/editpasteair", "Pastes the clipboard (with air)");
commands.put("/editstack", "<Count> <Dir> - Stacks the selection"); commands.put("/editstack", "<Count> <Dir> - Stacks the selection");
@ -540,8 +541,20 @@ public class WorldEdit {
return true; return true;
// Copy // Copy
} else if (split[0].equalsIgnoreCase("/editcopy")) { } 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]); checkArgs(split, 0, 0, split[0]);
}
Region region = session.getRegion(); Region region = session.getRegion();
Vector min = region.getMinimumPoint(); Vector min = region.getMinimumPoint();
Vector max = region.getMaximumPoint(); Vector max = region.getMaximumPoint();
@ -553,7 +566,12 @@ public class WorldEdit {
clipboard.copy(editSession); clipboard.copy(editSession);
session.setClipboard(clipboard); session.setClipboard(clipboard);
if (cut) {
editSession.setBlocks(session.getRegion(), block);
player.print("Block(s) cut.");
} else {
player.print("Block(s) copied."); player.print("Block(s) copied.");
}
return true; return true;