From d69dc979587a534334b86de1bfabeda16cc83a1a Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 20 Jun 2024 18:24:41 +0200 Subject: [PATCH] fix: take confirm-large from default limit for unlimited, add option to override (#2782) - fixes #2706 --- .../src/main/java/com/fastasyncworldedit/core/Fawe.java | 3 +++ .../com/fastasyncworldedit/core/configuration/Settings.java | 5 +++++ .../java/com/fastasyncworldedit/core/limit/FaweLimit.java | 4 +++- .../java/com/sk89q/worldedit/command/WorldEditCommands.java | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java index ff2f69486..829f29da6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java @@ -2,6 +2,7 @@ package com.fastasyncworldedit.core; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.internal.exception.FaweException; +import com.fastasyncworldedit.core.limit.FaweLimit; import com.fastasyncworldedit.core.queue.implementation.QueueHandler; import com.fastasyncworldedit.core.util.CachedTextureUtil; import com.fastasyncworldedit.core.util.CleanTextureUtil; @@ -105,6 +106,8 @@ public class Fawe { * Implementation dependent stuff */ this.setupConfigs(); + FaweLimit.MAX.CONFIRM_LARGE = + Settings.settings().LIMITS.get("default").CONFIRM_LARGE || Settings.settings().GENERAL.LIMIT_UNLIMITED_CONFIRMS; TaskManager.IMP = this.implementation.getTaskManager(); TaskManager.taskManager().async(() -> { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java index cf0ba6f35..d069e62a1 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java @@ -791,6 +791,11 @@ public class Settings extends Config { }) public boolean UNSTUCK_ON_GENERATE = true; + @Comment({ + "If unlimited limits should still require /confirm on large. Defaults to limits.default.confirm-large otherwise." + }) + public boolean LIMIT_UNLIMITED_CONFIRMS = true; + } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java index 5ecc89d44..e30ee4db6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java @@ -1,6 +1,7 @@ package com.fastasyncworldedit.core.limit; import com.fastasyncworldedit.core.FaweCache; +import com.fastasyncworldedit.core.configuration.Settings; import java.util.Collections; import java.util.Set; @@ -121,7 +122,8 @@ public class FaweLimit { MAX.SCHEM_FILE_SIZE_LIMIT = Integer.MAX_VALUE; MAX.MAX_EXPRESSION_MS = 50; MAX.FAST_PLACEMENT = true; - MAX.CONFIRM_LARGE = true; + MAX.CONFIRM_LARGE = + Settings.settings().LIMITS.get("default").CONFIRM_LARGE || Settings.settings().GENERAL.LIMIT_UNLIMITED_CONFIRMS; MAX.RESTRICT_HISTORY_TO_REGIONS = false; MAX.STRIP_NBT = Collections.emptySet(); MAX.UNIVERSAL_DISALLOWED_BLOCKS = false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java index db611b75c..04274a79a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java @@ -22,6 +22,8 @@ package com.sk89q.worldedit.command; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.FaweVersion; import com.fastasyncworldedit.core.configuration.Caption; +import com.fastasyncworldedit.core.configuration.Settings; +import com.fastasyncworldedit.core.limit.FaweLimit; import com.fastasyncworldedit.core.util.UpdateNotification; import com.intellectualsites.paster.IncendoPaster; import com.sk89q.worldedit.LocalSession; @@ -97,6 +99,8 @@ public class WorldEditCommands { .getConfiguration())); //FAWE start Fawe.instance().setupConfigs(); + FaweLimit.MAX.CONFIRM_LARGE = + Settings.settings().LIMITS.get("default").CONFIRM_LARGE || Settings.settings().GENERAL.LIMIT_UNLIMITED_CONFIRMS; //FAWE end actor.print(Caption.of("worldedit.reload.config")); }