diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/ai/AsyncGoalExecutor.java b/leaf-server/src/main/java/org/dreeam/leaf/async/ai/AsyncGoalExecutor.java index d01e365b..b02ad4ab 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/async/ai/AsyncGoalExecutor.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/async/ai/AsyncGoalExecutor.java @@ -65,7 +65,7 @@ public class AsyncGoalExecutor { submit(id); } } - if ((tickCount & 10L) == 10L) { + if ((tickCount % AsyncTargetFinding.threshold) == 0L) { unpark(); } tickCount += 1; diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncTargetFinding.java b/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncTargetFinding.java index 478f132c..adf14fd7 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncTargetFinding.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncTargetFinding.java @@ -16,6 +16,7 @@ public class AsyncTargetFinding extends ConfigModules { public static boolean searchBlock = true; public static boolean searchEntity = true; public static int queueSize = 4096; + public static long threshold = 10L; private static boolean asyncTargetFindingInitialized; @Override @@ -36,11 +37,15 @@ public class AsyncTargetFinding extends ConfigModules { alertOther = config.getBoolean(getBasePath() + ".async-alert-other", true); searchBlock = config.getBoolean(getBasePath() + ".async-search-block", true); searchEntity = config.getBoolean(getBasePath() + ".async-search-entity", true); - queueSize = config.getInt(getBasePath() + ".queue-size", 4096); + queueSize = config.getInt(getBasePath() + ".queue-size", 0); + threshold = config.getLong(getBasePath() + ".threshold", 0); if (queueSize <= 0) { queueSize = 4096; } + if (threshold <= 0L) { + threshold = 10L; + } if (!enabled) { alertOther = false; searchEntity = false;