From 8c44c532c4f53456e337a45652976d5e00221386 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 29 Jun 2019 02:35:41 +1000 Subject: [PATCH] 753b34ef9932e14316d3be6b2e6a63ef99fc38ed --- .../worldedit/command/ClipboardCommands.java | 18 +++++++++--------- .../function/operation/ForwardExtentCopy.java | 5 ++--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java index b0f920dac..050908187 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java @@ -113,7 +113,7 @@ public class ClipboardCommands extends MethodCommands { desc = "Lazily copy the selection to the clipboard", help = "Lazily copy the selection to the clipboard\n" + "Flags:\n" + - " -e will also copy entities\n" + + " -e skips copying entities\n" + " -m sets a source mask so that excluded blocks become air\n" + " -b copies biomes\n" + "WARNING: Pasting entities cannot yet be undone!", @@ -121,7 +121,7 @@ public class ClipboardCommands extends MethodCommands { ) @CommandPermissions("worldedit.clipboard.lazycopy") public void lazyCopy(Player player, LocalSession session, EditSession editSession, - @Selection final Region region, @Switch('e') boolean copyEntities, + @Selection final Region region, @Switch('e') boolean skipEntities, @Switch('m') Mask mask, @Switch('b') boolean copyBiomes) throws WorldEditException { BlockVector3 min = region.getMinimumPoint(); BlockVector3 max = region.getMaximumPoint(); @@ -135,7 +135,7 @@ public class ClipboardCommands extends MethodCommands { final int mx = origin.getBlockX(); final int my = origin.getBlockY(); final int mz = origin.getBlockZ(); - ReadOnlyClipboard lazyClipboard = ReadOnlyClipboard.of(editSession, region, copyEntities, copyBiomes); + ReadOnlyClipboard lazyClipboard = ReadOnlyClipboard.of(editSession, region, !skipEntities, copyBiomes); BlockArrayClipboard clipboard = new BlockArrayClipboard(region, lazyClipboard); clipboard.setOrigin(session.getPlacementPosition(player)); @@ -152,7 +152,7 @@ public class ClipboardCommands extends MethodCommands { desc = "Copy the selection to the clipboard", help = "Copy the selection to the clipboard\n" + "Flags:\n" + - " -e will also copy entities\n" + + " -e skips copying entities\n" + " -m sets a source mask so that excluded blocks become air\n" + " -b copies biomes\n" + "WARNING: Pasting entities cannot yet be undone!", @@ -161,7 +161,7 @@ public class ClipboardCommands extends MethodCommands { ) @CommandPermissions("worldedit.clipboard.copy") public void copy(FawePlayer fp, Player player, LocalSession session, EditSession editSession, - @Selection Region region, @Switch('e') boolean copyEntities, + @Selection Region region, @Switch('e') boolean skipEntities, @Switch('m') Mask mask, CommandContext context, @Switch('b') boolean copyBiomes) throws WorldEditException { BlockVector3 min = region.getMinimumPoint(); BlockVector3 max = region.getMaximumPoint(); @@ -178,7 +178,7 @@ public class ClipboardCommands extends MethodCommands { clipboard.setOrigin(pos); ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint()); - copy.setCopyingEntities(copyEntities); + copy.setCopyingEntities(!skipEntities); copy.setCopyBiomes(copyBiomes); Mask sourceMask = editSession.getSourceMask(); if (sourceMask != null) { @@ -242,7 +242,7 @@ public class ClipboardCommands extends MethodCommands { desc = "Cut the selection to the clipboard", help = "Copy the selection to the clipboard\n" + "Flags:\n" + - " -e will also cut entities\n" + + " -e skips entity copy\n" + " -m sets a source mask so that excluded blocks become air\n" + " -b copies biomes\n" + "WARNING: Cutting and pasting entities cannot yet be undone!", @@ -251,7 +251,7 @@ public class ClipboardCommands extends MethodCommands { @CommandPermissions("worldedit.clipboard.cut") @Logging(REGION) public void cut(FawePlayer fp, 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 skipEntities, @Switch('m') Mask mask, @Switch('b') boolean copyBiomes, CommandContext context) throws WorldEditException { BlockVector3 min = region.getMinimumPoint(); BlockVector3 max = region.getMaximumPoint(); @@ -270,7 +270,7 @@ public class ClipboardCommands extends MethodCommands { clipboard.setOrigin(pos); ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint()); copy.setSourceFunction(new BlockReplace(editSession, leavePattern)); - copy.setCopyingEntities(copyEntities); + copy.setCopyingEntities(!skipEntities); copy.setRemovingEntities(true); copy.setCopyBiomes(copyBiomes); Mask sourceMask = editSession.getSourceMask(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java index 9f55f46b5..72239cb43 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java @@ -53,6 +53,7 @@ import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.entity.EntityTypes; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -365,7 +366,7 @@ public class ForwardExtentCopy implements Operation { .filter(e -> e.getType() != EntityTypes.PLAYER) .collect(Collectors.toList()); } else { - entities = new ArrayList<>(); + entities = Collections.emptyList(); } @@ -374,8 +375,6 @@ public class ForwardExtentCopy implements Operation { if (!entities.isEmpty()) { ExtentEntityCopy entityCopy = new ExtentEntityCopy(from.toVector3(), destination, to.toVector3(), currentTransform); -// if (copyingEntities) { -// ExtentEntityCopy entityCopy = new ExtentEntityCopy(from, destination, to, currentTransform); entityCopy.setRemoving(removingEntities); EntityVisitor entityVisitor = new EntityVisitor(entities.iterator(), entityCopy); Operations.completeBlindly(entityVisitor);