mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2025-01-17 13:51:30 +01:00
Add restrictions to region copy
This commit is contained in:
parent
a9cafb13a2
commit
6439f28c0c
@ -128,7 +128,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
|
|||||||
MainUtil.handleError(e);
|
MainUtil.handleError(e);
|
||||||
}
|
}
|
||||||
this.raf = new BufferedRandomAccessFile(file, "rw", 16);
|
this.raf = new BufferedRandomAccessFile(file, "rw", 16);
|
||||||
long volume = width * height * length * 2l + HEADER_SIZE;
|
long volume = (long) width * (long) height * (long) length * 2l + (long) HEADER_SIZE;
|
||||||
raf.setLength(0);
|
raf.setLength(0);
|
||||||
raf.setLength(volume);
|
raf.setLength(volume);
|
||||||
// write length etc
|
// write length etc
|
||||||
|
@ -26,6 +26,7 @@ import com.boydti.fawe.object.FawePlayer;
|
|||||||
import com.boydti.fawe.object.RunnableVal2;
|
import com.boydti.fawe.object.RunnableVal2;
|
||||||
import com.boydti.fawe.object.clipboard.ReadOnlyClipboard;
|
import com.boydti.fawe.object.clipboard.ReadOnlyClipboard;
|
||||||
import com.boydti.fawe.object.clipboard.WorldCutClipboard;
|
import com.boydti.fawe.object.clipboard.WorldCutClipboard;
|
||||||
|
import com.boydti.fawe.object.exception.FaweException;
|
||||||
import com.boydti.fawe.object.io.FastByteArrayOutputStream;
|
import com.boydti.fawe.object.io.FastByteArrayOutputStream;
|
||||||
import com.boydti.fawe.util.ImgurUtility;
|
import com.boydti.fawe.util.ImgurUtility;
|
||||||
import com.boydti.fawe.util.MaskTraverser;
|
import com.boydti.fawe.util.MaskTraverser;
|
||||||
@ -139,6 +140,12 @@ public class ClipboardCommands {
|
|||||||
public void copy(Player player, LocalSession session, EditSession editSession,
|
public void copy(Player player, LocalSession session, EditSession editSession,
|
||||||
@Selection Region region, @Switch('e') boolean copyEntities,
|
@Selection Region region, @Switch('e') boolean copyEntities,
|
||||||
@Switch('m') Mask mask) throws WorldEditException {
|
@Switch('m') Mask mask) throws WorldEditException {
|
||||||
|
Vector min = region.getMinimumPoint();
|
||||||
|
Vector max = region.getMaximumPoint();
|
||||||
|
long volume = (((long)max.getX() - (long)min.getX() + 1) * ((long)max.getY() - (long)min.getY() + 1) * ((long)max.getZ() - (long)min.getZ() + 1));
|
||||||
|
if (volume >= Integer.MAX_VALUE) {
|
||||||
|
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||||
|
}
|
||||||
|
|
||||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId());
|
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId());
|
||||||
|
|
||||||
@ -175,7 +182,6 @@ public class ClipboardCommands {
|
|||||||
public void lazyCut(Player player, LocalSession session, EditSession editSession,
|
public void lazyCut(Player player, LocalSession session, EditSession editSession,
|
||||||
@Selection final Region region, @Switch('e') boolean copyEntities,
|
@Selection final Region region, @Switch('e') boolean copyEntities,
|
||||||
@Switch('m') Mask mask) throws WorldEditException {
|
@Switch('m') Mask mask) throws WorldEditException {
|
||||||
|
|
||||||
final Vector origin = region.getMinimumPoint();
|
final Vector origin = region.getMinimumPoint();
|
||||||
final int mx = origin.getBlockX();
|
final int mx = origin.getBlockX();
|
||||||
final int my = origin.getBlockY();
|
final int my = origin.getBlockY();
|
||||||
@ -205,7 +211,12 @@ public class ClipboardCommands {
|
|||||||
public void cut(Player player, LocalSession session, EditSession editSession,
|
public void cut(Player player, LocalSession session, EditSession editSession,
|
||||||
@Selection Region region, @Optional("air") Pattern leavePattern, @Switch('e') boolean copyEntities,
|
@Selection Region region, @Optional("air") Pattern leavePattern, @Switch('e') boolean copyEntities,
|
||||||
@Switch('m') Mask mask) throws WorldEditException {
|
@Switch('m') Mask mask) throws WorldEditException {
|
||||||
|
Vector min = region.getMinimumPoint();
|
||||||
|
Vector max = region.getMaximumPoint();
|
||||||
|
long volume = (((long)max.getX() - (long)min.getX() + 1) * ((long)max.getY() - (long)min.getY() + 1) * ((long)max.getZ() - (long)min.getZ() + 1));
|
||||||
|
if (volume >= Integer.MAX_VALUE) {
|
||||||
|
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||||
|
}
|
||||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId());
|
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId());
|
||||||
clipboard.setOrigin(session.getPlacementPosition(player));
|
clipboard.setOrigin(session.getPlacementPosition(player));
|
||||||
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
|
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
|
||||||
|
Loading…
Reference in New Issue
Block a user