From 2c56e480c3a4171d71c71103e965ae4f376fb368 Mon Sep 17 00:00:00 2001 From: JayemCeekay Date: Tue, 2 Nov 2021 11:38:39 -0500 Subject: [PATCH] Expand certain FAWE limits to use Long instead of Integer. (#1382) --- .../core/configuration/Settings.java | 8 ++++---- .../com/fastasyncworldedit/core/limit/FaweLimit.java | 12 ++++++------ .../main/java/com/sk89q/worldedit/EditSession.java | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) 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 30f0aaa8c..31ea71ead 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 @@ -164,9 +164,9 @@ public class Settings extends Config { @Comment("Max actions that can be run concurrently (i.e. commands)") public int MAX_ACTIONS = 1; @Comment("Max number of block changes (e.g. by `//set stone`).") - public int MAX_CHANGES = 50000000; + public long MAX_CHANGES = 50000000; @Comment("Max number of blocks checked (e.g. `//count stone` which doesn't change blocks)") - public int MAX_CHECKS = 50000000; + public long MAX_CHECKS = 50000000; @Comment("Number of times a change can fail (e.g. if the player can't access that region)") public int MAX_FAILS = 50000000; @Comment("Allowed brush iterations (e.g. `//brush smooth`)") @@ -616,7 +616,7 @@ public class Settings extends Config { ); limit.MAX_CHANGES = Math.max( limit.MAX_CHANGES, - newLimit.MAX_CHANGES != -1 ? newLimit.MAX_CHANGES : Integer.MAX_VALUE + newLimit.MAX_CHANGES != -1 ? newLimit.MAX_CHANGES : Long.MAX_VALUE ); limit.MAX_BLOCKSTATES = Math.max( limit.MAX_BLOCKSTATES, @@ -624,7 +624,7 @@ public class Settings extends Config { ); limit.MAX_CHECKS = Math.max( limit.MAX_CHECKS, - newLimit.MAX_CHECKS != -1 ? newLimit.MAX_CHECKS : Integer.MAX_VALUE + newLimit.MAX_CHECKS != -1 ? newLimit.MAX_CHECKS : Long.MAX_VALUE ); limit.MAX_ENTITIES = Math.max( limit.MAX_ENTITIES, 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 df9cfd16c..c899c668d 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 @@ -7,9 +7,9 @@ import java.util.Set; public class FaweLimit { public int MAX_ACTIONS = 0; - public int MAX_CHANGES = 0; + public long MAX_CHANGES = 0; public int MAX_FAILS = 0; - public int MAX_CHECKS = 0; + public long MAX_CHECKS = 0; public int MAX_ITERATIONS = 0; public int MAX_BLOCKSTATES = 0; public int MAX_ENTITIES = 0; @@ -103,9 +103,9 @@ public class FaweLimit { MAX.SPEED_REDUCTION = 0; MAX.INVENTORY_MODE = 0; MAX.MAX_ACTIONS = 1; - MAX.MAX_CHANGES = Integer.MAX_VALUE; + MAX.MAX_CHANGES = Long.MAX_VALUE; MAX.MAX_FAILS = Integer.MAX_VALUE; - MAX.MAX_CHECKS = Integer.MAX_VALUE; + MAX.MAX_CHECKS = Long.MAX_VALUE; MAX.MAX_ITERATIONS = Integer.MAX_VALUE; MAX.MAX_BLOCKSTATES = Integer.MAX_VALUE; MAX.MAX_ENTITIES = Integer.MAX_VALUE; @@ -229,9 +229,9 @@ public class FaweLimit { } public boolean isUnlimited() { - return MAX_CHANGES == Integer.MAX_VALUE + return MAX_CHANGES == Long.MAX_VALUE && MAX_FAILS == Integer.MAX_VALUE - && MAX_CHECKS == Integer.MAX_VALUE + && MAX_CHECKS == Long.MAX_VALUE && MAX_ITERATIONS == Integer.MAX_VALUE && MAX_BLOCKSTATES == Integer.MAX_VALUE && MAX_ENTITIES == Integer.MAX_VALUE diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index b99d98f90..5ac56564b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -532,7 +532,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @see #getLimit() */ @Deprecated - public int getBlockChangeLimit() { + public long getBlockChangeLimit() { return originalLimit.MAX_CHANGES; } @@ -541,7 +541,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * * @param limit the limit (>= 0) or -1 for no limit */ - public void setBlockChangeLimit(int limit) { + public void setBlockChangeLimit(long limit) { this.limit.MAX_CHANGES = limit; }