@Command( aliases = { "forestgen" }, usage = "[size] [type] [density]", desc = "Generate a forest", min = 0, max = 3 ) @CommandPermissions("worldedit.generation.forest") @Logging(POSITION) public void forestGen(Player player, LocalSession session, EditSession editSession, @Optional("10") int size, @Optional("tree") TreeType type, @Optional("5") double density) throws WorldEditException { density = density / 100; int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, type); player.print(affected + " trees created."); }
} else if (annotation instanceof Optional) { parameter.setOptional(true); String[] value = ((Optional) annotation).value(); if (value.length > 0) { parameter.setDefaultValue(value);
@Command( aliases = { "/hollow" }, usage = "[<thickness>[ <block>]]", desc = "Hollows out the object contained in this selection", help = "Hollows out the object contained in this selection.\n" + "Optionally fills the hollowed out part with the given block.\n" + "Thickness is measured in manhattan distance.", min = 0, max = 2 ) @CommandPermissions("worldedit.region.hollow") @Logging(REGION) public void hollow(Player player, EditSession editSession, @Selection Region region, @Optional("0") @Range(min = 0) int thickness, @Optional("air") Pattern pattern) throws WorldEditException { int affected = editSession.hollowOutRegion(region, thickness, pattern); player.print(affected + " block(s) have been changed."); }
public void list(Actor actor, CommandContext args, @Switch('p') @Optional("1") int page) throws WorldEditException { File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().saveDir); List<File> fileList = allFiles(dir);
@Command( aliases = { "/hsphere" }, usage = "<block> <radius>[,<radius>,<radius>] [raised?]", desc = "Generates a hollow sphere.", help = "Generates a hollow sphere.\n" + "By specifying 3 radii, separated by commas,\n" + "you can generate an ellipsoid. The order of the ellipsoid radii\n" + "is north/south, up/down, east/west.", min = 2, max = 3 ) @CommandPermissions("worldedit.generation.sphere") @Logging(PLACEMENT) public void hsphere(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("false") boolean raised) throws WorldEditException { sphere(player, session, editSession, pattern, radiusString, raised, true); }
@Command( aliases = { "/hcyl" }, usage = "<pattern> <radius>[,<radius>] [height]", desc = "Generates a hollow cylinder.", help = "Generates a hollow cylinder.\n" + "By specifying 2 radii, separated by a comma,\n" + "you can generate elliptical cylinders.\n" + "The 1st radius is north/south, the 2nd radius is east/west.", min = 2, max = 3 ) @CommandPermissions("worldedit.generation.cylinder") @Logging(PLACEMENT) public void hcyl(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("1") int height) throws WorldEditException { cyl(player, session, editSession, pattern, radiusString, height, true); }
@Command( aliases = { "descend", "desc" }, usage = "[# of floors]", desc = "Go down a floor", min = 0, max = 1 ) @CommandPermissions("worldedit.navigation.descend") public void descend(Player player, @Optional("1") int levelsToDescend) throws WorldEditException { int descentLevels = 0; while (player.descendLevel()) { ++descentLevels; if (levelsToDescend == descentLevels) { break; } } if (descentLevels == 0) { player.printError("No free spot below you found."); } else { player.print((descentLevels != 1) ? "Descended " + Integer.toString(descentLevels) + " levels." : "Descended a level."); } }
@Command( aliases = { "ascend", "asc" }, usage = "[# of levels]", desc = "Go up a floor", min = 0, max = 1 ) @CommandPermissions("worldedit.navigation.ascend") public void ascend(Player player, @Optional("1") int levelsToAscend) throws WorldEditException { int ascentLevels = 0; while (player.ascendLevel()) { ++ascentLevels; if (levelsToAscend == ascentLevels) { break; } } if (ascentLevels == 0) { player.printError("No free spot above you found."); } else { player.print((ascentLevels != 1) ? "Ascended " + Integer.toString(ascentLevels) + " levels." : "Ascended a level."); } }
@Command( aliases = { "smooth" }, usage = "[size] [iterations]", desc = "Choose the terrain softener brush", help = "Chooses the terrain softener brush.", min = 0, max = 2 ) @CommandPermissions("worldedit.brush.smooth") public void smoothBrush(Player player, LocalSession session, EditSession editSession, @Optional("2") double radius, @Optional("4") int iterations) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setSize(radius); tool.setBrush(new SmoothBrush(iterations), "worldedit.brush.smooth"); player.print(String.format("Smooth brush equipped (%.0f x %dx, using any block).", radius, iterations)); }
@Command( aliases = { "/rotate" }, usage = "<y-axis> [<x-axis>] [<z-axis>]", desc = "Rotate the contents of the clipboard", help = "Non-destructively rotate the contents of the clipboard.\n" + "Angles are provided in degrees and a positive angle will result in a clockwise rotation. " + "Multiple rotations can be stacked. Interpolation is not performed so angles should be a multiple of 90 degrees.\n" ) @CommandPermissions("worldedit.clipboard.rotate") public void rotate(Player player, LocalSession session, Double yRotate, @Optional Double xRotate, @Optional Double zRotate) throws WorldEditException { if ((yRotate != null && Math.abs(yRotate % 90) > 0.001) || xRotate != null && Math.abs(xRotate % 90) > 0.001 || zRotate != null && Math.abs(zRotate % 90) > 0.001) { player.printDebug("Note: Interpolation is not yet supported, so angles that are multiples of 90 is recommended."); } ClipboardHolder holder = session.getClipboard(); AffineTransform transform = new AffineTransform(); transform = transform.rotateY(-(yRotate != null ? yRotate : 0)); transform = transform.rotateX(-(xRotate != null ? xRotate : 0)); transform = transform.rotateZ(-(zRotate != null ? zRotate : 0)); holder.setTransform(holder.getTransform().combine(transform)); player.print("The clipboard copy has been rotated."); }
public void cyl(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("1") int height, @Switch('h') boolean hollow) throws WorldEditException { String[] radii = radiusString.split(","); final double radiusX, radiusZ;
public void sphere(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("false") boolean raised, @Switch('h') boolean hollow) throws WorldEditException { String[] radii = radiusString.split(","); final double radiusX, radiusY, radiusZ;
@Command( aliases = { "pumpkins" }, usage = "[size]", desc = "Generate pumpkin patches", min = 0, max = 1 ) @CommandPermissions("worldedit.generation.pumpkins") @Logging(POSITION) public void pumpkins(Player player, LocalSession session, EditSession editSession, @Optional("10") int apothem) throws WorldEditException { int affected = editSession.makePumpkinPatches(session.getPlacementPosition(player), apothem); player.print(affected + " pumpkin patches created."); }
@Command( aliases = { "/gmask", "gmask" }, usage = "[mask]", desc = "Set the global mask", min = 0, max = -1 ) @CommandPermissions("worldedit.global-mask") public void gmask(Player player, LocalSession session, EditSession editSession, @Optional Mask mask) throws WorldEditException { if (mask == null) { session.setMask((Mask) null); player.print("Global mask disabled."); } else { session.setMask(mask); player.print("Global mask set."); } }
@Command( aliases = { "/replace", "/re", "/rep" }, usage = "[from-block] <to-block>", desc = "Replace all blocks in the selection with another", flags = "f", min = 1, max = 2 ) @CommandPermissions("worldedit.region.replace") @Logging(REGION) public void replace(Player player, EditSession editSession, @Selection Region region, @Optional Mask from, Pattern to) throws WorldEditException { if (from == null) { from = new ExistingBlockMask(editSession); } int affected = editSession.replaceBlocks(region, from, to); player.print(affected + " block(s) have been replaced."); }
@Command( aliases = { "cylinder", "cyl", "c" }, usage = "<block> [radius] [height]", flags = "h", desc = "Choose the cylinder brush", help = "Chooses the cylinder brush.\n" + "The -h flag creates hollow cylinders instead.", min = 1, max = 3 ) @CommandPermissions("worldedit.brush.cylinder") public void cylinderBrush(Player player, LocalSession session, EditSession editSession, Pattern fill, @Optional("2") double radius, @Optional("1") int height, @Switch('h') boolean hollow) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(height); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setFill(fill); tool.setSize(radius); if (hollow) { tool.setBrush(new HollowCylinderBrush(height), "worldedit.brush.cylinder"); } else { tool.setBrush(new CylinderBrush(height), "worldedit.brush.cylinder"); } player.print(String.format("Cylinder brush shape equipped (%.0f by %d).", radius, height)); }
public void load(Player player, LocalSession session, @Optional("sponge") String formatName, String filename) throws FilenameException { LocalConfiguration config = worldEdit.getConfiguration();
public void move(Player player, EditSession editSession, LocalSession session, @Selection Region region, @Optional("1") @Range(min = 1) int count, @Optional(Direction.AIM) @Direction(includeDiagonals = true) BlockVector3 direction, @Optional("air") Pattern replace, @Switch('s') boolean moveSelection) throws WorldEditException {
@Command( aliases = { "gravity", "grav" }, usage = "[radius]", flags = "h", desc = "Gravity brush", help = "This brush simulates the affect of gravity.\n" + "The -h flag makes it affect blocks starting at the world's max y, " + "instead of the clicked block's y + radius.", min = 0, max = 1 ) @CommandPermissions("worldedit.brush.gravity") public void gravityBrush(Player player, LocalSession session, EditSession editSession, @Optional("5") double radius, @Switch('h') boolean fromMaxY) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setSize(radius); tool.setBrush(new GravityBrush(fromMaxY), "worldedit.brush.gravity"); player.print(String.format("Gravity brush equipped (%.0f).", radius)); }
@Command( aliases = { "/curve" }, usage = "<block> [thickness]", desc = "Draws a spline through selected points", help = "Draws a spline through selected points.\n" + "Can only be used with convex polyhedral selections.\n" + "Flags:\n" + " -h generates only a shell", flags = "h", min = 1, max = 2 ) @CommandPermissions("worldedit.region.curve") @Logging(REGION) public void curve(Player player, EditSession editSession, @Selection Region region, Pattern pattern, @Optional("0") @Range(min = 0) int thickness, @Switch('h') boolean shell) throws WorldEditException { if (!(region instanceof ConvexPolyhedralRegion)) { player.printError("//curve only works with convex polyhedral selections"); return; } ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region; List<BlockVector3> vectors = new ArrayList<>(cpregion.getVertices()); int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell); player.print(blocksChanged + " block(s) have been changed."); }