diff --git a/build.gradle b/build.gradle index 4f3849a4..09542708 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ ext { date = git.head().date.format("yy.MM.dd") revision = "-${git.head().abbreviatedId}" parents = git.head().parentIds; - index = -81; // Offset to mach CI + index = -82; // Offset to mach CI int major, minor, patch; major = minor = patch = 0; for (;parents != null && !parents.isEmpty();index++) { diff --git a/core/src/main/java/com/boydti/fawe/config/Settings.java b/core/src/main/java/com/boydti/fawe/config/Settings.java index 0b404992..14d6b0e3 100644 --- a/core/src/main/java/com/boydti/fawe/config/Settings.java +++ b/core/src/main/java/com/boydti/fawe/config/Settings.java @@ -108,7 +108,7 @@ public class Settings extends Config { }) public int MAX_HISTORY_MB = -1; @Comment("Maximum time in milliseconds //calc can execute") - public int MAX_CALC_MS = 50; + public int MAX_EXPRESSION_MS = 50; @Comment({ "Cinematic block placement:", " - Adds a delay to block placement (ms/block)", @@ -367,7 +367,7 @@ public class Settings extends Config { limit.MAX_FAILS = Math.max(limit.MAX_FAILS, newLimit.MAX_FAILS != -1 ? newLimit.MAX_FAILS : Integer.MAX_VALUE); limit.MAX_ITERATIONS = Math.max(limit.MAX_ITERATIONS, newLimit.MAX_ITERATIONS != -1 ? newLimit.MAX_ITERATIONS : Integer.MAX_VALUE); limit.MAX_HISTORY = Math.max(limit.MAX_HISTORY, newLimit.MAX_HISTORY_MB != -1 ? newLimit.MAX_HISTORY_MB : Integer.MAX_VALUE); - limit.MAX_CALC_MS = Math.max(limit.MAX_CALC_MS, newLimit.MAX_CALC_MS != -1 ? newLimit.MAX_CALC_MS : Integer.MAX_VALUE); + limit.MAX_EXPRESSION_MS = Math.max(limit.MAX_EXPRESSION_MS, newLimit.MAX_EXPRESSION_MS != -1 ? newLimit.MAX_EXPRESSION_MS : Integer.MAX_VALUE); limit.INVENTORY_MODE = Math.min(limit.INVENTORY_MODE, newLimit.INVENTORY_MODE); limit.SPEED_REDUCTION = Math.min(limit.SPEED_REDUCTION, newLimit.SPEED_REDUCTION); limit.FAST_PLACEMENT |= newLimit.FAST_PLACEMENT; diff --git a/core/src/main/java/com/boydti/fawe/object/FaweLimit.java b/core/src/main/java/com/boydti/fawe/object/FaweLimit.java index 4252d36a..84e7dcae 100644 --- a/core/src/main/java/com/boydti/fawe/object/FaweLimit.java +++ b/core/src/main/java/com/boydti/fawe/object/FaweLimit.java @@ -12,7 +12,7 @@ public class FaweLimit { public int MAX_BLOCKSTATES = 0; public int MAX_ENTITIES = 0; public int MAX_HISTORY = 0; - public int MAX_CALC_MS = 0; + public int MAX_EXPRESSION_MS = 0; public int INVENTORY_MODE = Integer.MAX_VALUE; public int SPEED_REDUCTION = Integer.MAX_VALUE; public boolean FAST_PLACEMENT = false; @@ -56,7 +56,7 @@ public class FaweLimit { MAX.MAX_BLOCKSTATES = Integer.MAX_VALUE; MAX.MAX_ENTITIES = Integer.MAX_VALUE; MAX.MAX_HISTORY = Integer.MAX_VALUE; - MAX.MAX_CALC_MS = 50; + MAX.MAX_EXPRESSION_MS = 50; MAX.FAST_PLACEMENT = true; } diff --git a/core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java b/core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java index ac1a8f3c..72dd5b9f 100644 --- a/core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java +++ b/core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java @@ -514,17 +514,7 @@ public class UtilityCommands { @CommandPermissions("worldedit.calc") public void calc(final Actor actor, @Text String input) throws CommandException { try { - FaweLimit limit; - FawePlayer player = null; - if (actor != null) { - player = FawePlayer.wrap(actor); - } - if (player == null) { - limit = FaweLimit.MAX; - } else { - limit = player.getLimit(); - } - + FaweLimit limit = FawePlayer.wrap(actor).getLimit(); final Expression expression = Expression.compile(input); final AtomicDouble result = new AtomicDouble(Double.NaN); ExecutorService executor = Executors.newSingleThreadExecutor(); @@ -535,7 +525,7 @@ public class UtilityCommands { result.set(expression.evaluate()); return null; } - }), limit.MAX_CALC_MS, TimeUnit.MILLISECONDS); // Default timeout of 50 milliseconds to prevent abuse. + }), limit.MAX_EXPRESSION_MS, TimeUnit.MILLISECONDS); // Default timeout of 50 milliseconds to prevent abuse. } catch (InterruptedException e) { throw new RuntimeException(e); }