Remove height from //expand vert.

With new world height limits, this will cause more confusion than good.
`//outset -v` or `//expand u,d` can replicate the previous behavior.
This commit is contained in:
wizjany 2021-11-30 22:19:14 -05:00
parent 63d2ad4ec3
commit f53282715e

View File

@ -19,18 +19,15 @@
package com.sk89q.worldedit.command;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.argument.HeightConverter;
import com.sk89q.worldedit.command.util.Logging;
import com.sk89q.worldedit.command.util.PermissionCondition;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.internal.annotation.Direction;
import com.sk89q.worldedit.internal.annotation.MultiDirection;
import com.sk89q.worldedit.internal.annotation.VertHeight;
import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
@ -44,15 +41,12 @@
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.inject.Key;
import org.enginehub.piston.part.CommandArgument;
import org.enginehub.piston.part.SubCommandPart;
import java.util.List;
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
import static com.sk89q.worldedit.internal.command.CommandUtil.requireIV;
import static java.util.Objects.requireNonNull;
import static org.enginehub.piston.part.CommandParts.arg;
/**
* Extracted from {@link SelectionCommands} to allow importing of {@link Command}.
@ -93,32 +87,22 @@ public static void register(CommandRegistrationHandler registration,
}
private static Command createVertCommand(CommandManager commandManager) {
CommandArgument heightPart = arg(
TranslatableComponent.of("height"),
TextComponent.of("The height to expand both upwards and downwards")
)
.defaultsTo(ImmutableList.of(HeightConverter.DEFAULT_VALUE))
.build();
return commandManager.newCommand("vert")
.addPart(heightPart)
.description(TranslatableComponent.of("worldedit.expand.description.vert"))
.action(parameters -> {
int height = requireNonNull(parameters.valueOf(heightPart)
.asSingle(Key.of(int.class, VertHeight.class)));
expandVert(
requireIV(Key.of(LocalSession.class), "localSession", parameters),
requireIV(Key.of(Actor.class), "actor", parameters),
requireIV(Key.of(World.class), "world", parameters),
height
requireIV(Key.of(World.class), "world", parameters)
);
return 1;
})
.build();
}
private static void expandVert(LocalSession session, Actor actor, World world,
int height) throws IncompleteRegionException {
private static void expandVert(LocalSession session, Actor actor, World world) throws IncompleteRegionException {
Region region = session.getSelection(world);
int height = world.getMaxY() - world.getMinY();
try {
long oldSize = region.getVolume();
region.expand(