mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-15 04:41:37 +08:00
Add //placement, which sets either pos1 or player explicitly
This commit is contained in:
parent
21a465b902
commit
d28fadb842
@ -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"},
|
||||
|
@ -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 <E extends Enum<E>> ArgumentConverter<E> basic(Class<E> enumClass) {
|
||||
|
@ -35,4 +35,5 @@
|
||||
@InjectAnnotation
|
||||
public @interface Offset {
|
||||
String FORWARD = "forward";
|
||||
String ZERO = "0,0,0";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user