From a620ca9efe6e7173e5174a7591434d6c8372641a Mon Sep 17 00:00:00 2001 From: sk89q Date: Sun, 3 Oct 2010 17:04:06 -0700 Subject: [PATCH] Added /editoutline. --- src/WorldEdit.java | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/WorldEdit.java b/src/WorldEdit.java index 36bbeba34..51c509918 100644 --- a/src/WorldEdit.java +++ b/src/WorldEdit.java @@ -56,7 +56,8 @@ public class WorldEdit extends Plugin { commands.put("/clearhistory", "Clear history"); commands.put("/clearclipboard", "Clear clipboard"); commands.put("/editsize", "Get size of selected region"); - commands.put("/editset", " - Set all blocks inside region"); + commands.put("/editset", " - Set all blocks inside region"); + commands.put("/editoutline", " - Outline the region with blocks"); commands.put("/editreplace", " - Replace all existing blocks inside region"); commands.put("/editoverlay", " - Overlay the area one layer"); commands.put("/removeabove", " - Remove blocks above head"); @@ -537,6 +538,43 @@ public class WorldEdit extends Plugin { return true; + // Set the outline of a region + } else if(split[0].equalsIgnoreCase("/editoutline")) { + checkArgs(split, 1); + int blockType = getItem(split[1]); + int affected = 0; + + for (int x = lowerX; x <= upperX; x++) { + for (int y = lowerY; y <= upperY; y++) { + editSession.setBlock(x, y, lowerZ, blockType); + editSession.setBlock(x, y, upperZ, blockType); + affected++; + } + } + + for (int y = lowerY; y <= upperY; y++) { + for (int z = lowerZ; z <= upperZ; z++) { + editSession.setBlock(lowerX, y, z, blockType); + editSession.setBlock(upperX, y, z, blockType); + affected++; + } + } + + for (int z = lowerZ; z <= upperZ; z++) { + for (int x = lowerX; x <= upperX; x++) { + editSession.setBlock(x, lowerY, z, blockType); + editSession.setBlock(x, upperY, z, blockType); + affected++; + } + } + + logger.log(Level.INFO, player.getName() + " used /editoutline"); + player.sendMessage(Colors.LightPurple + affected + " block(s) have been set."); + + session.remember(editSession); + + return true; + // Replace all blocks in the region } else if(split[0].equalsIgnoreCase("/editreplace")) { checkArgs(split, 1);