Fix #fullcopy -r (#1816)

This commit is contained in:
Jordan 2022-06-19 00:59:11 +01:00 committed by GitHub
parent aadd35c0c4
commit 84f6039f41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View File

@ -38,9 +38,9 @@ public class RandomFullClipboardPatternParser extends RichParser<Pattern> {
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<Pattern> {
));
}
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<ClipboardHolder> 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()));

View File

@ -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();