diff --git a/src/com/sk89q/worldedit/commands/SelectionCommands.java b/src/com/sk89q/worldedit/commands/SelectionCommands.java index 0367a6590..e7eb479b4 100644 --- a/src/com/sk89q/worldedit/commands/SelectionCommands.java +++ b/src/com/sk89q/worldedit/commands/SelectionCommands.java @@ -311,7 +311,7 @@ public class SelectionCommands { usage = " [direction]", desc = "Shift the selection area", min = 1, - max = 3 + max = 2 ) @CommandPermissions({"worldedit.selection.shift"}) public static void shift(CommandContext args, WorldEdit we, @@ -335,6 +335,72 @@ public class SelectionCommands { player.print("Region shifted."); } + @Command( + aliases = {"/outset"}, + usage = "", + desc = "Outset the selection area", + flags = "hv", + min = 1, + max = 1 + ) + @CommandPermissions({"worldedit.selection.outset"}) + public static void outset(CommandContext args, WorldEdit we, + LocalSession session, LocalPlayer player, EditSession editSession) + throws WorldEditException { + int change = args.getInteger(0); + + Region region = session.getRegion(); + + if (!args.hasFlag('h')) { + region.expand((new Vector(0, 1, 0)).multiply(change)); + region.expand((new Vector(0, -1, 0)).multiply(change)); + } + + if (!args.hasFlag('v')) { + region.expand((new Vector(1, 0, 0)).multiply(change)); + region.expand((new Vector(-1, 0, 0)).multiply(change)); + region.expand((new Vector(0, 0, 1)).multiply(change)); + region.expand((new Vector(0, 0, -1)).multiply(change)); + } + + session.learnRegionChanges(); + + player.print("Region outset."); + } + + @Command( + aliases = {"/inset"}, + usage = "", + desc = "Inset the selection area", + flags = "hv", + min = 1, + max = 1 + ) + @CommandPermissions({"worldedit.selection.outset"}) + public static void inset(CommandContext args, WorldEdit we, + LocalSession session, LocalPlayer player, EditSession editSession) + throws WorldEditException { + int change = args.getInteger(0); + + Region region = session.getRegion(); + + if (!args.hasFlag('h')) { + region.contract((new Vector(0, 1, 0)).multiply(change)); + region.contract((new Vector(0, -1, 0)).multiply(change)); + } + + if (!args.hasFlag('v')) { + region.contract((new Vector(1, 0, 0)).multiply(change)); + region.contract((new Vector(-1, 0, 0)).multiply(change)); + region.contract((new Vector(0, 0, 1)).multiply(change)); + region.contract((new Vector(0, 0, -1)).multiply(change)); + } + + session.learnRegionChanges(); + + player.print("Region inset."); + } + @Command( aliases = {"/size"}, usage = "",