Added /editoutline.

This commit is contained in:
sk89q 2010-10-03 17:04:06 -07:00
parent bb06f9daed
commit a620ca9efe

View File

@ -57,6 +57,7 @@ public class WorldEdit extends Plugin {
commands.put("/clearclipboard", "Clear clipboard"); commands.put("/clearclipboard", "Clear clipboard");
commands.put("/editsize", "Get size of selected region"); commands.put("/editsize", "Get size of selected region");
commands.put("/editset", "<Type> - Set all blocks inside region"); commands.put("/editset", "<Type> - Set all blocks inside region");
commands.put("/editoutline", "<Type> - Outline the region with blocks");
commands.put("/editreplace", "<ID> <ToReplaceID> - Replace all existing blocks inside region"); commands.put("/editreplace", "<ID> <ToReplaceID> - Replace all existing blocks inside region");
commands.put("/editoverlay", "<ID> - Overlay the area one layer"); commands.put("/editoverlay", "<ID> - Overlay the area one layer");
commands.put("/removeabove", "<Size> - Remove blocks above head"); commands.put("/removeabove", "<Size> - Remove blocks above head");
@ -537,6 +538,43 @@ public class WorldEdit extends Plugin {
return true; 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 // Replace all blocks in the region
} else if(split[0].equalsIgnoreCase("/editreplace")) { } else if(split[0].equalsIgnoreCase("/editreplace")) {
checkArgs(split, 1); checkArgs(split, 1);