From 65c81997b9d552d39ed1005975f9e9824eebccf6 Mon Sep 17 00:00:00 2001 From: bigguy345 Date: Sun, 29 Jun 2025 11:04:13 +0300 Subject: [PATCH] Parallel IAction chain methods --- java/noppes/npcs/api/handler/data/IAction.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/java/noppes/npcs/api/handler/data/IAction.java b/java/noppes/npcs/api/handler/data/IAction.java index 5d645b1..3a2f214 100644 --- a/java/noppes/npcs/api/handler/data/IAction.java +++ b/java/noppes/npcs/api/handler/data/IAction.java @@ -41,6 +41,9 @@ public interface IAction { /** * @return the maximum number of ticks this action is allowed to run before auto-terminating + * + * P.S: If the max duration is reached and this IAction is threaded using {@link #threadify()} and the thread is paused using any of the pausing methods, + * the thread is forcibly resumed and finishes the task execution once. */ int getMaxDuration(); @@ -149,6 +152,21 @@ public interface IAction { */ IAction getPrevious(); + /** + * Enqueue another IAction on the parallel chain which starts firing simultaneously as this. + * + * @param after the action to run next + */ + IAction parallel(IAction after); + + IAction parallel(Consumer task); + + IAction parallel(int delay, Consumer task); + + IAction parallel(String name, Consumer task); + + IAction parallel(String name, int startAfterTicks, Consumer task); + /** * Enqueue another action immediately after this one. *