@Command( aliases = {"/rotate"}, usage = "<y-axis> [<x-axis>] [<z-axis>]", desc = "Rotate the contents of the clipboard", help = "Non-destructively rotate the contents of the clipboard.\n" + "Angles are provided in degrees and a positive angle will result in a clockwise rotation. " + "Multiple rotations can be stacked. Interpolation is not performed so angles should be a multiple of 90 degrees.\n") @CommandPermissions("worldedit.clipboard.rotate") public void rotate( Player player, LocalSession session, Double yRotate, @Optional Double xRotate, @Optional Double zRotate) throws WorldEditException { if ((yRotate != null && Math.abs(yRotate % 90) > 0.001) || xRotate != null && Math.abs(xRotate % 90) > 0.001 || zRotate != null && Math.abs(zRotate % 90) > 0.001) { player.printDebug( "Note: Interpolation is not yet supported, so angles that are multiples of 90 is recommended."); } ClipboardHolder holder = session.getClipboard(); AffineTransform transform = new AffineTransform(); transform = transform.rotateY(-(yRotate != null ? yRotate : 0)); transform = transform.rotateX(-(xRotate != null ? xRotate : 0)); transform = transform.rotateZ(-(zRotate != null ? zRotate : 0)); holder.setTransform(holder.getTransform().combine(transform)); player.print("The clipboard copy has been rotated."); }
@Command( aliases = {"/flip"}, usage = "[<direction>]", desc = "Flip the contents of the clipboard", help = "Flips the contents of the clipboard across the point from which the copy was made.\n", min = 0, max = 1) @CommandPermissions("worldedit.clipboard.flip") public void flip( Player player, LocalSession session, EditSession editSession, @Optional(Direction.AIM) @Direction Vector direction) throws WorldEditException { ClipboardHolder holder = session.getClipboard(); Clipboard clipboard = holder.getClipboard(); AffineTransform transform = new AffineTransform(); transform = transform.scale(direction.positive().multiply(-2).add(1, 1, 1)); holder.setTransform(holder.getTransform().combine(transform)); player.print("The clipboard copy has been flipped."); }