diff --git a/java/noppes/npcs/api/handler/IActionManager.java b/java/noppes/npcs/api/handler/IActionManager.java index a9e6f10..e821c2d 100644 --- a/java/noppes/npcs/api/handler/IActionManager.java +++ b/java/noppes/npcs/api/handler/IActionManager.java @@ -4,6 +4,7 @@ import noppes.npcs.api.handler.data.IAction; import noppes.npcs.api.handler.data.IActionChain; import noppes.npcs.api.handler.data.actions.IConditionalAction; +import java.util.List; import java.util.Queue; import java.util.function.Consumer; import java.util.function.Supplier; @@ -113,7 +114,7 @@ public interface IActionManager { * @ maxChecks maximum times to test predicate before auto‐cancelling * @return the action scheduled */ - IConditionalAction scheduleConditionalAction(String name, Supplier predicate, Consumer task); + IConditionalAction scheduleAction(String name, Supplier predicate, Consumer task); /** * Schedule a conditional action that gives up after at most maxChecks attempts. @@ -126,7 +127,15 @@ public interface IActionManager { * @ maxChecks maximum times to test predicate before auto‐cancelling * @return the action scheduled */ - IConditionalAction scheduleConditionalAction(String name, Supplier predicate, Supplier terminateWhen, Consumer task); + IConditionalAction scheduleAction(String name, Supplier predicate, Supplier terminateWhen, Consumer task); + + IConditionalAction scheduleAction(IConditionalAction action); + + /** + * + * @return the list of all conditional actions + */ + List getConditionalActions(); /** * Cancel (remove) the first queued action with the given name. @@ -178,17 +187,16 @@ public interface IActionManager { * Convenience: create & enqueue a conditional task that re-checks forever. */ default void addConditionalTask(String name, Supplier predicate, Consumer task) { - scheduleConditionalAction(name, predicate, task); + scheduleAction(name, predicate, task); } /** * Convenience: create & enqueue a conditional task that gives up after maxChecks. */ default void addConditionalTask(String name, Supplier predicate, Supplier terminateWhen, Consumer task) { - scheduleConditionalAction(name, predicate, terminateWhen, task); + scheduleAction(name, predicate, terminateWhen, task); } - IConditionalAction scheduleConditionalAction(IConditionalAction action); IActionChain chain(); }