private BlockVector3[] getChangesForEachDir(CommandContext args) { List<BlockVector3> changes = new ArrayList<>(6); int change = args.getInteger(0); if (!args.hasFlag('h')) { changes.add((BlockVector3.at(0, 1, 0)).multiply(change)); changes.add((BlockVector3.at(0, -1, 0)).multiply(change)); } if (!args.hasFlag('v')) { changes.add((BlockVector3.at(1, 0, 0)).multiply(change)); changes.add((BlockVector3.at(-1, 0, 0)).multiply(change)); changes.add((BlockVector3.at(0, 0, 1)).multiply(change)); changes.add((BlockVector3.at(0, 0, -1)).multiply(change)); } return changes.toArray(new BlockVector3[0]); }
@Command( aliases = { "/removebelow", "removebelow" }, usage = "[size] [height]", desc = "Remove blocks below you.", min = 0, max = 2 ) @CommandPermissions("worldedit.removebelow") @Logging(PLACEMENT) public void removeBelow(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1; we.checkMaxRadius(size); World world = player.getWorld(); int height = args.argsLength() > 1 ? Math.min((world.getMaxY() + 1), args.getInteger(1) + 2) : (world.getMaxY() + 1); int affected = editSession.removeBelow(session.getPlacementPosition(player), size, height); player.print(affected + " block(s) have been removed."); }
@Command( aliases = { "/removeabove", "removeabove" }, usage = "[size] [height]", desc = "Remove blocks above your head.", min = 0, max = 2 ) @CommandPermissions("worldedit.removeabove") @Logging(PLACEMENT) public void removeAbove(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1; we.checkMaxRadius(size); World world = player.getWorld(); int height = args.argsLength() > 1 ? Math.min((world.getMaxY() + 1), args.getInteger(1) + 2) : (world.getMaxY() + 1); int affected = editSession.removeAbove( session.getPlacementPosition(player), size, height); player.print(affected + " block(s) have been removed."); }
int num = args.argsLength() > 0 ? Math.min(40, Math.max(5, args.getInteger(0))) : 5;
@Command( aliases = { "/ex", "/ext", "/extinguish", "ex", "ext", "extinguish" }, usage = "[radius]", desc = "Extinguish nearby fire", min = 0, max = 1 ) @CommandPermissions("worldedit.extinguish") @Logging(PLACEMENT) public void extinguish(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { LocalConfiguration config = we.getConfiguration(); int defaultRadius = config.maxRadius != -1 ? Math.min(40, config.maxRadius) : 40; int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : defaultRadius; we.checkMaxRadius(size); int affected = editSession.removeNear(session.getPlacementPosition(player), BlockTypes.FIRE, size); player.print(affected + " block(s) have been removed."); }
@Command( aliases = { "range" }, usage = "[pattern]", desc = "Set the brush range", min = 1, max = 1 ) @CommandPermissions("worldedit.brush.options.range") public void range(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { int range = args.getInteger(0); session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setRange(range); player.print("Brush range set."); }
@Command( aliases = { "ceil" }, usage = "[clearance]", desc = "Go to the celing", flags = "fg", min = 0, max = 1 ) @CommandPermissions("worldedit.navigation.ceiling") @Logging(POSITION) public void ceiling(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { final int clearance = args.argsLength() > 0 ? Math.max(0, args.getInteger(0)) : 0; final boolean alwaysGlass = getAlwaysGlass(args); if (player.ascendToCeiling(clearance, alwaysGlass)) { player.print("Whoosh!"); } else { player.printError("No free spot above you found."); } }
@Command( aliases = { "/limit" }, usage = "<limit>", desc = "Modify block change limit", min = 1, max = 1 ) @CommandPermissions("worldedit.limit") public void limit(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { LocalConfiguration config = worldEdit.getConfiguration(); boolean mayDisable = player.hasPermission("worldedit.limit.unrestricted"); int limit = Math.max(-1, args.getInteger(0)); if (!mayDisable && config.maxChangeLimit > -1) { if (limit > config.maxChangeLimit) { player.printError("Your maximum allowable limit is " + config.maxChangeLimit + "."); return; } } session.setBlockChangeLimit(limit); if (limit != -1) { player.print("Block change limit set to " + limit + ". (Use //limit -1 to go back to the default.)"); } else { player.print("Block change limit set to " + limit + "."); } }
@Command( aliases = { "size" }, usage = "[pattern]", desc = "Set the brush size", min = 1, max = 1 ) @CommandPermissions("worldedit.brush.options.size") public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { int radius = args.getInteger(0); we.checkMaxBrushRadius(radius); session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setSize(radius); player.print("Brush size set."); } }
@Command( aliases = { "up" }, usage = "<block>", desc = "Go upwards some distance", flags = "fg", min = 1, max = 1 ) @CommandPermissions("worldedit.navigation.up") @Logging(POSITION) public void up(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { final int distance = args.getInteger(0); final boolean alwaysGlass = getAlwaysGlass(args); if (player.ascendUpwards(distance, alwaysGlass)) { player.print("Whoosh!"); } else { player.printError("You would hit something above you."); } }
int change = args.getInteger(0); if (args.argsLength() == 2) { if (args.getString(1).contains(",")) {
@Command( aliases = { "area" }, usage = "<radius>", desc = "Enable the area super pickaxe pickaxe mode", min = 1, max = 1 ) @CommandPermissions("worldedit.superpickaxe.area") public void area(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { LocalConfiguration config = we.getConfiguration(); int range = args.getInteger(0); if (range > config.maxSuperPickaxeSize) { player.printError("Maximum range: " + config.maxSuperPickaxeSize); return; } session.setSuperPickaxe(new AreaPickaxe(range)); session.enableSuperPickAxe(); player.print("Mode changed. Left click with a pickaxe. // to disable."); }
@Command( aliases = { "/fill" }, usage = "<block> <radius> [depth]", desc = "Fill a hole", min = 2, max = 3 ) @CommandPermissions("worldedit.fill") @Logging(PLACEMENT) public void fill(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { ParserContext context = new ParserContext(); context.setActor(player); context.setWorld(player.getWorld()); context.setSession(session); Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context); double radius = Math.max(1, args.getDouble(1)); we.checkMaxRadius(radius); int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : 1; BlockVector3 pos = session.getPlacementPosition(player); int affected = editSession.fillXZ(pos, pattern, radius, depth, false); player.print(affected + " block(s) have been created."); }
public void remove(Actor actor, CommandContext args) throws WorldEditException, CommandException { String typeStr = args.getString(0); int radius = args.getInteger(1); Player player = actor instanceof Player ? (Player) actor : null;
@Command( aliases = { "/fillr" }, usage = "<block> <radius> [depth]", desc = "Fill a hole recursively", min = 2, max = 3 ) @CommandPermissions("worldedit.fill.recursive") @Logging(PLACEMENT) public void fillr(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { ParserContext context = new ParserContext(); context.setActor(player); context.setWorld(player.getWorld()); context.setSession(session); Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context); double radius = Math.max(1, args.getDouble(1)); we.checkMaxRadius(radius); int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : Integer.MAX_VALUE; BlockVector3 pos = session.getPlacementPosition(player); int affected = 0; if (pattern instanceof BlockPattern) { affected = editSession.fillXZ(pos, ((BlockPattern) pattern).getBlock(), radius, depth, true); } else { affected = editSession.fillXZ(pos, pattern, radius, depth, true); } player.print(affected + " block(s) have been created."); }
@Command( aliases = { "/removenear", "removenear" }, usage = "<block> [size]", desc = "Remove blocks near you.", min = 1, max = 2 ) @CommandPermissions("worldedit.removenear") @Logging(PLACEMENT) public void removeNear(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { ParserContext context = new ParserContext(); context.setActor(player); context.setWorld(player.getWorld()); context.setSession(session); context.setRestricted(false); context.setPreferringWildcard(false); BaseBlock block = we.getBlockFactory().parseFromInput(args.getString(0), context); int size = Math.max(1, args.getInteger(1, 50)); we.checkMaxRadius(size); int affected = editSession.removeNear(session.getPlacementPosition(player), block.getBlockType(), size); player.print(affected + " block(s) have been removed."); }
public void redo(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { int times = Math.max(1, args.getInteger(0, 1));
int count = 0; if (args.argsLength() == 0 || (page = args.getInteger(0)) < 2) { page = 1; offset = 0;
int times = Math.max(1, args.getInteger(0, 1)); for (int i = 0; i < times; ++i) { EditSession undone;
public void replaceNear(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { int size = Math.max(1, args.getInteger(0)); int affected; Set<BaseBlock> from;