mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 17:57:38 +00: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 enum BlockType {
|
|||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
* @deprecated Use {@link #canPassThrough(int,int)} instead
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public static boolean canPassThrough(int id) {
|
public static boolean canPassThrough(int id) {
|
||||||
return canPassThrough.contains(id);
|
return canPassThrough.contains(id);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import com.sk89q.worldedit.*;
|
|||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.blocks.BlockID;
|
import com.sk89q.worldedit.blocks.BlockID;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
|
import com.sk89q.worldedit.regions.CuboidRegionSelector;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -139,13 +140,14 @@ public class ClipboardCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
aliases = { "/paste" },
|
aliases = { "/paste" },
|
||||||
usage = "",
|
usage = "",
|
||||||
flags = "ao",
|
flags = "sao",
|
||||||
desc = "Paste the clipboard's contents",
|
desc = "Paste the clipboard's contents",
|
||||||
help =
|
help =
|
||||||
"Pastes the clipboard's contents.\n" +
|
"Pastes the clipboard's contents.\n" +
|
||||||
"Flags:\n" +
|
"Flags:\n" +
|
||||||
" -a skips air blocks\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,
|
min = 0,
|
||||||
max = 0
|
max = 0
|
||||||
)
|
)
|
||||||
@ -157,18 +159,33 @@ public class ClipboardCommands {
|
|||||||
boolean atOrigin = args.hasFlag('o');
|
boolean atOrigin = args.hasFlag('o');
|
||||||
boolean pasteNoAir = args.hasFlag('a');
|
boolean pasteNoAir = args.hasFlag('a');
|
||||||
|
|
||||||
|
CuboidClipboard clipboard = session.getClipboard();
|
||||||
|
|
||||||
|
Vector pos = atOrigin ? session.getClipboard().getOrigin()
|
||||||
|
: session.getPlacementPosition(player);
|
||||||
|
|
||||||
if (atOrigin) {
|
if (atOrigin) {
|
||||||
Vector pos = session.getClipboard().getOrigin();
|
clipboard.place(editSession, pos, pasteNoAir);
|
||||||
session.getClipboard().place(editSession, pos, pasteNoAir);
|
clipboard.pasteEntities(pos);
|
||||||
session.getClipboard().pasteEntities(pos);
|
|
||||||
player.findFreePosition();
|
player.findFreePosition();
|
||||||
player.print("Pasted to copy origin. Undo with //undo");
|
player.print("Pasted to copy origin. Undo with //undo");
|
||||||
} else {
|
} else {
|
||||||
Vector pos = session.getPlacementPosition(player);
|
clipboard.paste(editSession, pos, pasteNoAir, true);
|
||||||
session.getClipboard().paste(editSession, pos, pasteNoAir, true);
|
|
||||||
player.findFreePosition();
|
player.findFreePosition();
|
||||||
player.print("Pasted relative to you. Undo with //undo");
|
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(
|
@Command(
|
||||||
|
Loading…
Reference in New Issue
Block a user