From 00e0ac721fde0e591d5ca0bc5999ad1a0c553b15 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 24 Nov 2019 04:08:17 +0000 Subject: [PATCH] Fix confirmation --- .../worldedit/command/util/annotation/Confirm.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Confirm.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Confirm.java index 5c539343b..30c62b53e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Confirm.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Confirm.java @@ -42,10 +42,11 @@ public @interface Confirm { @Override public boolean passes(Actor actor, InjectedValueAccess context, double value) { Region region = context.injectedValue(Key.of(Region.class, Selection.class)).orElseThrow(IncompleteRegionException::new); - BlockVector3 min = region.getMinimumPoint(); - BlockVector3 max = region.getMaximumPoint(); - long area = (max.getX() - min.getX()) * (max.getZ() - min.getZ() + 1) * (int) value; - if (area > 2 << 18) { + BlockVector3 pos1 = region.getMinimumPoint(); + BlockVector3 pos2 = region.getMaximumPoint(); + long area = (pos2.getX() - pos1.getX()) * (pos2.getZ() - pos1.getZ() + 1) * (long) value; + long max = 2 << 18; // TODO configurable? + if (max != -1 && area > max) { actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , min, max, getArgs(context))); return confirm(actor, context); } @@ -56,7 +57,7 @@ public @interface Confirm { @Override public boolean passes(Actor actor, InjectedValueAccess context, double value) { int max = WorldEdit.getInstance().getConfiguration().maxRadius; - if (value > max) { + if (max != -1 && value > max) { actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , value, max, getArgs(context))); return Processor.confirm(actor, context); } @@ -67,7 +68,7 @@ public @interface Confirm { @Override public boolean passes(Actor actor, InjectedValueAccess context, double value) { int max = 50;// TODO configurable, get Key.of(Method.class) @Limit - if (value > max) { + if (max != -1 && value > max) { actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , value, max, getArgs(context))); return Processor.confirm(actor, context); }