From 84f6039f41d00d9728a816a5b4d58c0b2824d882 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sun, 19 Jun 2022 00:59:11 +0100 Subject: [PATCH] Fix #fullcopy -r (#1816) --- .../pattern/RandomFullClipboardPatternParser.java | 12 ++++++------ .../function/pattern/RandomFullClipboardPattern.java | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RandomFullClipboardPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RandomFullClipboardPatternParser.java index 44043dc4d..2af68adc8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RandomFullClipboardPatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RandomFullClipboardPatternParser.java @@ -38,9 +38,9 @@ public class RandomFullClipboardPatternParser extends RichParser { case 0: if (argumentInput.equals("#") || argumentInput.equals("#c")) { return Stream.of("#copy", "#clipboard"); - } else if ("#copy".startsWith(argumentInput.toUpperCase(Locale.ROOT))) { + } else if ("#copy".startsWith(argumentInput.toLowerCase(Locale.ROOT))) { return Stream.of("#copy"); - } else if ("#clipboard".startsWith(argumentInput.toUpperCase(Locale.ROOT))) { + } else if ("#clipboard".startsWith(argumentInput.toLowerCase(Locale.ROOT))) { return Stream.of("#clipboard"); } else { return Stream.empty(); @@ -62,11 +62,11 @@ public class RandomFullClipboardPatternParser extends RichParser { )); } try { - boolean rotate = arguments.length >= 2 && Boolean.getBoolean(arguments[1]); - boolean flip = arguments.length == 3 && Boolean.getBoolean(arguments[2]); + boolean rotate = arguments.length >= 2 && Boolean.parseBoolean(arguments[1]); + boolean flip = arguments.length == 3 && Boolean.parseBoolean(arguments[2]); List clipboards; - if ("#copy".startsWith(arguments[0].toUpperCase(Locale.ROOT)) || - "#clipboard".startsWith(arguments[0].toUpperCase(Locale.ROOT))) { + if ("#copy".startsWith(arguments[0].toLowerCase(Locale.ROOT)) || + "#clipboard".startsWith(arguments[0].toLowerCase(Locale.ROOT))) { ClipboardHolder clipboard = context.requireSession().getExistingClipboard(); if (clipboard == null) { throw new InputParseException(Caption.of("fawe.error.parse.no-clipboard", getPrefix())); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RandomFullClipboardPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RandomFullClipboardPattern.java index 9f0791eba..52348780b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RandomFullClipboardPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RandomFullClipboardPattern.java @@ -44,13 +44,12 @@ public class RandomFullClipboardPattern extends AbstractPattern { AffineTransform transform = new AffineTransform(); if (randomRotate) { transform = transform.rotateY(ThreadLocalRandom.current().nextInt(4) * 90); - holder.setTransform(new AffineTransform().rotateY(ThreadLocalRandom.current().nextInt(4) * 90)); } if (randomFlip && ThreadLocalRandom.current().nextBoolean()) { transform = transform.scale(flipVector); } if (!transform.isIdentity()) { - holder.setTransform(transform); + holder.setTransform(transform.combine(holder.getTransform())); } Clipboard clipboard = holder.getClipboard(); Transform newTransform = holder.getTransform();