From 28cc2d837bbf5caa6016e5a2c20cae7c02ad0319 Mon Sep 17 00:00:00 2001 From: bigguy345 Date: Tue, 29 Apr 2025 08:53:16 +0300 Subject: [PATCH] Re-ordered ConditionalAction's Supplier terminateWhen arg --- .../npcs/api/handler/IActionManager.java | 30 +++++++++---------- .../data/actions/IConditionalAction.java | 8 ++--- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/java/noppes/npcs/api/handler/IActionManager.java b/java/noppes/npcs/api/handler/IActionManager.java index d5ba614..1e3da63 100644 --- a/java/noppes/npcs/api/handler/IActionManager.java +++ b/java/noppes/npcs/api/handler/IActionManager.java @@ -59,45 +59,45 @@ public interface IActionManager { * Schedule a conditional action that gives up after at most maxChecks attempts. * * @param predicate supplier checked every tick, if it returns true, task is fired - * @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done) * @param task code to run once predicate first becomes true + * @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done) * @return the action scheduled */ - IConditionalAction create(Supplier predicate, Supplier terminateWhen, Consumer task); + IConditionalAction create(Supplier predicate, Consumer task, Supplier terminateWhen); /** * Schedule a conditional action that gives up after at most maxChecks attempts. * * @param name unique name * @param predicate supplier checked every tick, if it returns true, task is fired - * @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done) * @param task code to run once predicate first becomes true + * @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done) * @return the action scheduled */ - IConditionalAction create(String name, Supplier predicate, Supplier terminateWhen, Consumer task); + IConditionalAction create(String name, Supplier predicate, Consumer task, Supplier terminateWhen); /** * Schedule a conditional action that gives up after at most maxChecks attempts. * * @param predicate supplier checked every tick, if it returns true, task is fired - * @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done) * @param task code to run once predicate first becomes true + * @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done) * @param onTermination code to run when the termination predicate returns true * @return the action scheduled */ - IConditionalAction create(Supplier predicate, Supplier terminateWhen, Consumer task, Consumer onTermination); + IConditionalAction create(Supplier predicate, Consumer task, Supplier terminateWhen, Consumer onTermination); /** * Schedule a conditional action that gives up after at most maxChecks attempts. * * @param name unique name * @param predicate supplier checked every tick, if it returns true, task is fired - * @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done) * @param task code to run once predicate first becomes true + * @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done) * @param onTermination code to run when the termination predicate returns true * @return the action scheduled */ - IConditionalAction create(String name, Supplier predicate, Supplier terminateWhen, Consumer task, Consumer onTermination); + IConditionalAction create(String name, Supplier predicate, Consumer task, Supplier terminateWhen, Consumer onTermination); /** * Begin processing scheduled actions. Must be called once. @@ -174,13 +174,13 @@ public interface IActionManager { /** * Schedule a conditional action that gives up after at most maxChecks attempts. * - * @param name unique name - * @param predicate supplier checked every tick, if it returns true, task is fired - * @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done) - * @param task code to run once predicate first becomes true + * @param name unique name + * @param predicate supplier checked every tick, if it returns true, task is fired + * @param task code to run once predicate first becomes true + * @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done) * @return the action scheduled */ - IConditionalAction scheduleAction(String name, Supplier predicate, Supplier terminateWhen, Consumer task); + IConditionalAction scheduleAction(String name, Supplier predicate, Consumer task, Supplier terminateWhen); IConditionalAction scheduleAction(IConditionalAction action); @@ -246,8 +246,8 @@ public interface IActionManager { /** * Convenience: create & enqueue a conditional task that gives up after maxChecks. */ - default void addConditionalTask(String name, Supplier predicate, Supplier terminateWhen, Consumer task) { - scheduleAction(name, predicate, terminateWhen, task); + default void addConditionalTask(String name, Supplier predicate, Consumer task, Supplier terminateWhen) { + scheduleAction(name, predicate, task, terminateWhen); } diff --git a/java/noppes/npcs/api/handler/data/actions/IConditionalAction.java b/java/noppes/npcs/api/handler/data/actions/IConditionalAction.java index a35d19f..04255b8 100644 --- a/java/noppes/npcs/api/handler/data/actions/IConditionalAction.java +++ b/java/noppes/npcs/api/handler/data/actions/IConditionalAction.java @@ -56,11 +56,11 @@ public interface IConditionalAction extends IAction { IConditionalAction after(String name, Supplier predicate, Consumer task); - IConditionalAction after(Supplier predicate, Supplier terminate, Consumer task); + IConditionalAction after(Supplier predicate, Consumer task, Supplier terminate); - IConditionalAction after(String name, Supplier predicate, Supplier terminate, Consumer task); + IConditionalAction after(String name, Supplier predicate, Consumer task, Supplier terminate); - IConditionalAction after(Supplier predicate, Supplier terminateWhen, Consumer task, Consumer onTermination); + IConditionalAction after(Supplier predicate, Consumer task, Supplier terminateWhen, Consumer onTermination); - IConditionalAction after(String name, Supplier predicate, Supplier terminateWhen, Consumer task, Consumer onTermination); + IConditionalAction after(String name, Supplier predicate, Consumer task, Supplier terminateWhen, Consumer onTermination); }