mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-16 17:16:11 +00:00
Fix confirm deadlock and confirm permissions/limits (#718)
This commit is contained in:
parent
097f3ec473
commit
30863c36e7
@ -52,7 +52,8 @@ public @interface Confirm {
|
||||
* (long) value;
|
||||
long max = 2 << 18;
|
||||
if (max != -1 && area > max) {
|
||||
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region", pos1, pos2, getArgs(context)));
|
||||
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region",
|
||||
pos1, pos2, getArgs(context), region.getHeight() * area));
|
||||
return confirm(actor, context);
|
||||
}
|
||||
return true;
|
||||
@ -63,8 +64,9 @@ public @interface Confirm {
|
||||
public boolean passes(Actor actor, InjectedValueAccess context, double value) {
|
||||
int max = WorldEdit.getInstance().getConfiguration().maxRadius;
|
||||
if (max != -1 && value > max) {
|
||||
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region", value, max, getArgs(context)));
|
||||
return Processor.confirm(actor, context);
|
||||
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.radius",
|
||||
value, max, getArgs(context)));
|
||||
return confirm(actor, context);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -74,8 +76,9 @@ public @interface Confirm {
|
||||
public boolean passes(Actor actor, InjectedValueAccess context, double value) {
|
||||
int max = 50; //TODO configurable, get Key.of(Method.class) @Limit
|
||||
if (max != -1 && value > max) {
|
||||
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region", value, max, getArgs(context)));
|
||||
return Processor.confirm(actor, context);
|
||||
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.limit",
|
||||
value, max, getArgs(context)));
|
||||
return confirm(actor, context);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
|
||||
if (confirm == null) {
|
||||
return false;
|
||||
}
|
||||
queueAction(confirm::signal);
|
||||
confirm.signal();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.internal.command;
|
||||
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.sk89q.worldedit.command.util.annotation.Confirm;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
@ -46,6 +47,10 @@ public class ConfirmHandler implements CommandCallListener {
|
||||
return;
|
||||
}
|
||||
Actor actor = actorOpt.get();
|
||||
// don't check confirmation if actor doesn't need to confirm
|
||||
if (!Settings.IMP.getLimit(actor).CONFIRM_LARGE) {
|
||||
return;
|
||||
}
|
||||
if (!confirmAnnotation.value().passes(actor, parameters, 1)) {
|
||||
throw new StopExecutionException(TextComponent.empty());
|
||||
}
|
||||
|
@ -108,6 +108,8 @@
|
||||
"fawe.cancel.worldedit.cancel.count": "Cancelled {0} edits.",
|
||||
"fawe.cancel.worldedit.cancel.reason.confirm": "Use //confirm to execute {2}",
|
||||
"fawe.cancel.worldedit.cancel.reason.confirm.region": "Your selection is large ({0} -> {1}, containing {3} blocks). Use //confirm to execute {2}",
|
||||
"fawe.cancel.worldedit.cancel.reason.confirm.radius": "Your radius is large ({0} > {1}). Use //confirm to execute {2}",
|
||||
"fawe.cancel.worldedit.cancel.reason.confirm.limit": "You're exceeding your limit for this action ({0} > {1}). Use //confirm to execute {2}",
|
||||
"fawe.cancel.worldedit.cancel.reason": "Your WorldEdit action was cancelled: {0}.",
|
||||
"fawe.cancel.worldedit.cancel.reason.manual": "Manual cancellation",
|
||||
"fawe.cancel.worldedit.cancel.reason.low.memory": "Low memory",
|
||||
|
Loading…
Reference in New Issue
Block a user