@Command( aliases = {"/copy"}, flags = "em", desc = "Copy the selection to the clipboard", help = "Copy the selection to the clipboard\n" + "Flags:\n" + " -e controls whether entities are copied\n" + " -m sets a source mask so that excluded blocks become air\n" + "WARNING: Pasting entities cannot yet be undone!", min = 0, max = 0) @CommandPermissions("worldedit.clipboard.copy") public void copy( Player player, LocalSession session, EditSession editSession, @Selection Region region, @Switch('e') boolean copyEntities, @Switch('m') Mask mask) throws WorldEditException { BlockArrayClipboard clipboard = new BlockArrayClipboard(region); clipboard.setOrigin(session.getPlacementPosition(player)); ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint()); if (mask != null) { copy.setSourceMask(mask); } Operations.completeLegacy(copy); session.setClipboard(new ClipboardHolder(clipboard, editSession.getWorld().getWorldData())); player.print(region.getArea() + " block(s) were copied."); }
@Command( aliases = {"/copy"}, flags = "e", desc = "Копирует выделенную территорию в буфер обмена", help = "Копирует выделенную территорию в буфер обмен\n" + "Флаги:\n" + " -e определяет, будут ли объекты копироваться в буфер обмена\n" + "ПРЕДУПРЕЖДЕНИЕ: Вставленные объекты не могут быть отменены!", min = 0, max = 0) @CommandPermissions("worldedit.clipboard.copy") public void copy( CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession) throws WorldEditException { Region region = session.getSelection(player.getWorld()); Vector min = region.getMinimumPoint(); Vector max = region.getMaximumPoint(); Vector pos = session.getPlacementPosition(player); CuboidClipboard clipboard = new CuboidClipboard(max.subtract(min).add(new Vector(1, 1, 1)), min, min.subtract(pos)); clipboard.copy(editSession); if (args.hasFlag('e')) { for (LocalEntity entity : player.getWorld().getEntities(region)) { clipboard.storeEntity(entity); } } session.setClipboard(clipboard); player.print("Блок(и) скопирован(ы)."); }
@Command( aliases = {"clearclipboard"}, usage = "", desc = "Clear your clipboard", min = 0, max = 0) @CommandPermissions("worldedit.clipboard.clear") public void clearClipboard(Player player, LocalSession session, EditSession editSession) throws WorldEditException { session.setClipboard(null); player.print("Clipboard cleared."); }
@Command( aliases = {"clearclipboard"}, usage = "", desc = "Очищает Ваш буфер обмена", min = 0, max = 0) @CommandPermissions("worldedit.clipboard.clear") public void clearClipboard( CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession) throws WorldEditException { session.setClipboard(null); player.print("Буфер обмена очищен."); }
@Command( aliases = {"/cut"}, usage = "[leave-id]", desc = "Вырезает выделенную территорию в буфер обмена", help = "Вырезает выделенную территорию в буфер обмена\n" + "Флаги:\n" + " -e controls определяет, будут ли объекты копироваться в буфер обмена\n" + "ПРЕДУПРЕЖДЕНИЕ: Вырезанные и вставленные объекты не могут быть отменены!", flags = "e", min = 0, max = 1) @CommandPermissions("worldedit.clipboard.cut") @Logging(REGION) public void cut( CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession) throws WorldEditException { BaseBlock block = new BaseBlock(BlockID.AIR); LocalWorld world = player.getWorld(); if (args.argsLength() > 0) { block = we.getBlock(player, args.getString(0)); } Region region = session.getSelection(world); Vector min = region.getMinimumPoint(); Vector max = region.getMaximumPoint(); Vector pos = session.getPlacementPosition(player); CuboidClipboard clipboard = new CuboidClipboard(max.subtract(min).add(new Vector(1, 1, 1)), min, min.subtract(pos)); clipboard.copy(editSession); if (args.hasFlag('e')) { LocalEntity[] entities = world.getEntities(region); for (LocalEntity entity : entities) { clipboard.storeEntity(entity); } world.killEntities(entities); } session.setClipboard(clipboard); int affected = editSession.setBlocks(session.getSelection(world), block); player.print( affected + " " + StringUtil.plural(affected, "блок вырезан", "блока вырезано", "блоков вырезано") + "."); }