geforkt von Mirrors/FastAsyncWorldEdit
fix: upstream missing Region#getBoundingBox()
(#1908)
Use block change limit for //copy and //cut (cherry picked from commit fd8dbdd7b7b8b561db98a45b4eae3810dedb1551)
Dieser Commit ist enthalten in:
Ursprung
cc1b466a04
Commit
ab659eadde
@ -38,6 +38,7 @@ import com.google.common.collect.Lists;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
@ -105,6 +106,20 @@ import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class ClipboardCommands {
|
||||
|
||||
/**
|
||||
* Throws if the region would allocate a clipboard larger than the block change limit.
|
||||
*
|
||||
* @param region The region to check
|
||||
* @param session The session
|
||||
* @throws MaxChangedBlocksException if the volume exceeds the limit
|
||||
*/
|
||||
private void checkRegionBounds(Region region, LocalSession session) throws MaxChangedBlocksException {
|
||||
int limit = session.getBlockChangeLimit();
|
||||
if (region.getBoundingBox().getVolume() > limit) {
|
||||
throw new MaxChangedBlocksException(limit);
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/copy",
|
||||
aliases = "/cp",
|
||||
|
@ -256,6 +256,11 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
return pos1.getMaximum(pos2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CuboidRegion getBoundingBox() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumY() {
|
||||
return minY;
|
||||
|
@ -72,6 +72,15 @@ public interface Region extends Iterable<BlockVector3>, Cloneable, IBatchProcess
|
||||
}
|
||||
//FAWE end
|
||||
|
||||
/**
|
||||
* Get the bounding box of this region as a {@link CuboidRegion}.
|
||||
*
|
||||
* @return the bounding box
|
||||
*/
|
||||
default CuboidRegion getBoundingBox() {
|
||||
return new CuboidRegion(getMinimumPoint(), getMaximumPoint());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the center point of a region.
|
||||
* Note: Coordinates will not be integers
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren