mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-21 04:49:51 +08:00
Added -s flag to //paste to select the pasted area.
Also undeprecated a method that shouldn't have been.
This commit is contained in:
parent
ca44ee073a
commit
ab0d170d9a
@ -530,9 +530,7 @@ public static boolean shouldPlaceFinal(int id) {
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
* @deprecated Use {@link #canPassThrough(int,int)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean canPassThrough(int id) {
|
||||
return canPassThrough.contains(id);
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.CuboidRegionSelector;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
/**
|
||||
@ -139,13 +140,14 @@ public void cut(CommandContext args, LocalSession session, LocalPlayer player,
|
||||
@Command(
|
||||
aliases = { "/paste" },
|
||||
usage = "",
|
||||
flags = "ao",
|
||||
flags = "sao",
|
||||
desc = "Paste the clipboard's contents",
|
||||
help =
|
||||
"Pastes the clipboard's contents.\n" +
|
||||
"Flags:\n" +
|
||||
" -a skips air blocks\n" +
|
||||
" -o pastes at the original position",
|
||||
" -o pastes at the original position\n" +
|
||||
" -s selects the region after pasting",
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
@ -157,18 +159,33 @@ public void paste(CommandContext args, LocalSession session, LocalPlayer player,
|
||||
boolean atOrigin = args.hasFlag('o');
|
||||
boolean pasteNoAir = args.hasFlag('a');
|
||||
|
||||
CuboidClipboard clipboard = session.getClipboard();
|
||||
|
||||
Vector pos = atOrigin ? session.getClipboard().getOrigin()
|
||||
: session.getPlacementPosition(player);
|
||||
|
||||
if (atOrigin) {
|
||||
Vector pos = session.getClipboard().getOrigin();
|
||||
session.getClipboard().place(editSession, pos, pasteNoAir);
|
||||
session.getClipboard().pasteEntities(pos);
|
||||
clipboard.place(editSession, pos, pasteNoAir);
|
||||
clipboard.pasteEntities(pos);
|
||||
player.findFreePosition();
|
||||
player.print("Pasted to copy origin. Undo with //undo");
|
||||
} else {
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
session.getClipboard().paste(editSession, pos, pasteNoAir, true);
|
||||
clipboard.paste(editSession, pos, pasteNoAir, true);
|
||||
player.findFreePosition();
|
||||
player.print("Pasted relative to you. Undo with //undo");
|
||||
}
|
||||
|
||||
if (args.hasFlag('s')) {
|
||||
LocalWorld world = player.getWorld();
|
||||
Vector pos2 = pos.add(clipboard.getSize().subtract(1, 1, 1));
|
||||
if (!atOrigin) {
|
||||
pos2 = pos2.add(clipboard.getOffset());
|
||||
pos = pos.add(clipboard.getOffset());
|
||||
}
|
||||
session.setRegionSelector(world, new CuboidRegionSelector(world, pos, pos2));
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
session.getRegionSelector(world).explainRegionAdjust(player, session);
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
Loading…
Reference in New Issue
Block a user