From 70f0ab1e6f6dc7bb09a8d136479f33de31641542 Mon Sep 17 00:00:00 2001 From: bigguy345 Date: Tue, 8 Jul 2025 14:22:49 +0300 Subject: [PATCH] ActionQueue.stopWhenEmpty --- .../controllers/data/action/ActionQueue.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/noppes/npcs/controllers/data/action/ActionQueue.java b/src/main/java/noppes/npcs/controllers/data/action/ActionQueue.java index cd06bacf2..0a20f4a5a 100644 --- a/src/main/java/noppes/npcs/controllers/data/action/ActionQueue.java +++ b/src/main/java/noppes/npcs/controllers/data/action/ActionQueue.java @@ -19,6 +19,8 @@ public class ActionQueue implements IActionQueue { protected boolean isParallel; protected boolean isDead; + protected boolean stopWhenEmpty; + protected boolean killWhenEmpty; protected int killWhenEmptyAfter = 100; @@ -70,6 +72,18 @@ public class ActionQueue implements IActionQueue { isParallel = parallel; return this; } + + @Override + public boolean isStoppedWhenEmpty() { + return stopWhenEmpty; + } + + @Override + public IActionQueue stopWhenEmpty(boolean stopWhenEmpty) { + this.stopWhenEmpty = stopWhenEmpty; + return this; + } + @Override public boolean isKilledWhenEmpty() { return killWhenEmpty; @@ -309,6 +323,9 @@ public class ActionQueue implements IActionQueue { pit.remove(); } + if (stopWhenEmpty && !hasActiveTasks()) + stop(); + killWhenEmpty(); if (manager.debug && active)