Added //paste [-ao] syntax to paste without air and at origin.

Dieser Commit ist enthalten in:
sk89q 2011-01-29 12:01:14 -08:00
Ursprung d202bc4739
Commit aed274a1a5

Datei anzeigen

@ -95,29 +95,28 @@ public class ClipboardCommands {
@Command( @Command(
aliases = {"/paste"}, aliases = {"/paste"},
usage = "[at-origin?]", usage = "",
flags = "ao",
desc = "Paste the clipboard's contents", desc = "Paste the clipboard's contents",
min = 0, min = 0,
max = 1 max = 0
) )
@CommandPermissions({"worldedit.clipboard.paste"}) @CommandPermissions({"worldedit.clipboard.paste"})
public static void paste(CommandContext args, WorldEdit we, public static void paste(CommandContext args, WorldEdit we,
LocalSession session, LocalPlayer player, EditSession editSession) LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException { throws WorldEditException {
boolean atOrigin = args.argsLength() > 0 boolean atOrigin = args.hasFlag('o');
? (args.getString(0).equalsIgnoreCase("true") boolean pasteNoAir = args.hasFlag('a');
|| args.getString(0).equalsIgnoreCase("yes"))
: false;
if (atOrigin) { if (atOrigin) {
Vector pos = session.getClipboard().getOrigin(); Vector pos = session.getClipboard().getOrigin();
session.getClipboard().place(editSession, pos, false); session.getClipboard().place(editSession, pos, pasteNoAir);
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); Vector pos = session.getPlacementPosition(player);
session.getClipboard().paste(editSession, pos, false); session.getClipboard().paste(editSession, pos, pasteNoAir);
player.findFreePosition(); player.findFreePosition();
player.print("Pasted relative to you. Undo with //undo"); player.print("Pasted relative to you. Undo with //undo");
} }