diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java index ef5e2ddae..3d50bd0b1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java @@ -38,6 +38,7 @@ import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.visitor.RegionVisitor; +import com.sk89q.worldedit.internal.annotation.Offset; import com.sk89q.worldedit.internal.command.CommandRegistrationHandler; import com.sk89q.worldedit.internal.command.CommandUtil; import com.sk89q.worldedit.internal.cui.ServerCUIHandler; @@ -445,6 +446,23 @@ public void togglePlace(Actor actor, LocalSession session) { } } + @Command( + name = "placement", + aliases = {"/placement"}, + desc = "Select which placement to use" + ) + public void placement(Actor actor, LocalSession session, + @Arg(desc = "Which placement type to use") + PlacementType placementType, + @Arg(desc = "number of times to apply the offset", def = "1") + int multiplier, + @Arg(desc = "How much to offset from it placement to use", def = Offset.ZERO) + @Offset + BlockVector3 offset) { + offset = offset.multiply(multiplier); + placementImpl(actor, session, new Placement(placementType, offset)); + } + @Command( name = "searchitem", aliases = {"/searchitem", "/l", "/search"}, diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/EnumConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/EnumConverter.java index 806573f94..2af67b19e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/EnumConverter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/EnumConverter.java @@ -23,6 +23,7 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.command.util.HookMode; import com.sk89q.worldedit.extent.TracingExtent; +import com.sk89q.worldedit.session.PlacementType; import com.sk89q.worldedit.util.SideEffect; import com.sk89q.worldedit.util.TreeGenerator; import org.enginehub.piston.CommandManager; @@ -57,6 +58,8 @@ public static void register(CommandManager commandManager) { basic(HookMode.class)); commandManager.registerConverter(Key.of(TracingExtent.Action.class), basic(TracingExtent.Action.class)); + commandManager.registerConverter(Key.of(PlacementType.class), + basic(PlacementType.class)); } private static > ArgumentConverter basic(Class enumClass) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Offset.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Offset.java index 0772402fa..4a1807de5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Offset.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Offset.java @@ -35,4 +35,5 @@ @InjectAnnotation public @interface Offset { String FORWARD = "forward"; + String ZERO = "0,0,0"; }