diff --git a/java/noppes/npcs/api/handler/IActionManager.java b/java/noppes/npcs/api/handler/IActionManager.java index 7e26a5d..d0a6f95 100644 --- a/java/noppes/npcs/api/handler/IActionManager.java +++ b/java/noppes/npcs/api/handler/IActionManager.java @@ -39,65 +39,65 @@ 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 task code to run once predicate first becomes true + * @param condition supplier checked every tick, if it returns true, task is fired + * @param task code to run once condition first becomes true * @return the action scheduled */ - IConditionalAction create(Supplier predicate, Consumer task); + IConditionalAction create(Supplier condition, Consumer task); /** * 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 task code to run once predicate first becomes true + * @param condition supplier checked every tick, if it returns true, task is fired + * @param task code to run once condition first becomes true * @return the action scheduled */ - IConditionalAction create(String name, Supplier predicate, Consumer task); + IConditionalAction create(String name, Supplier condition, Consumer task); /** * 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 task code to run once predicate first becomes true + * @param condition supplier checked every tick, if it returns true, task is fired + * @param task code to run once condition 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, Consumer task, Supplier terminateWhen); + IConditionalAction create(Supplier condition, 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 task code to run once predicate first becomes true + * @param condition supplier checked every tick, if it returns true, task is fired + * @param task code to run once condition 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, Consumer task, Supplier terminateWhen); + IConditionalAction create(String name, Supplier condition, 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 task code to run once predicate first becomes true + * @param condition supplier checked every tick, if it returns true, task is fired + * @param task code to run once condition 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 + * @param onTermination code to run when the termination condition returns true * @return the action scheduled */ - IConditionalAction create(Supplier predicate, Consumer task, Supplier terminateWhen, Consumer onTermination); + IConditionalAction create(Supplier condition, 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 task code to run once predicate first becomes true + * @param condition supplier checked every tick, if it returns true, task is fired + * @param task code to run once condition 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 + * @param onTermination code to run when the termination condition returns true * @return the action scheduled */ - IConditionalAction create(String name, Supplier predicate, Consumer task, Supplier terminateWhen, Consumer onTermination); + IConditionalAction create(String name, Supplier condition, Consumer task, Supplier terminateWhen, Consumer onTermination); /** * Begin processing scheduled actions. Must be called once. @@ -164,35 +164,35 @@ 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 task code to run once predicate first becomes true + * @param name unique name + * @param condition supplier checked every tick, if it returns true, task is fired + * @param task code to run once condition first becomes true * @return the action scheduled */ - IConditionalAction scheduleAction(String name, Supplier predicate, Consumer task); + IConditionalAction scheduleAction(String name, Supplier condition, Consumer task); /** * 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 task code to run once predicate first becomes true + * @param condition supplier checked every tick, if it returns true, task is fired + * @param task code to run once condition 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, Consumer task, Supplier terminateWhen); + IConditionalAction scheduleAction(String name, Supplier condition, 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 task code to run once predicate first becomes true + * @param condition supplier checked every tick, if it returns true, task is fired + * @param task code to run once condition 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 + * @param onTermination code to run when the termination condition returns true * @return the action scheduled */ - IConditionalAction scheduleAction(String name, Supplier predicate, Consumer task, Supplier terminateWhen, Consumer onTermination); + IConditionalAction scheduleAction(String name, Supplier condition, Consumer task, Supplier terminateWhen, Consumer onTermination); IConditionalAction scheduleAction(IConditionalAction action); @@ -251,15 +251,15 @@ public interface IActionManager { /** * Convenience: create & enqueue a conditional task that re-checks forever. */ - default void addConditionalTask(String name, Supplier predicate, Consumer task) { - scheduleAction(name, predicate, task); + default void addConditionalTask(String name, Supplier condition, Consumer task) { + scheduleAction(name, condition, task); } /** * Convenience: create & enqueue a conditional task that gives up after maxChecks. */ - default void addConditionalTask(String name, Supplier predicate, Consumer task, Supplier terminateWhen) { - scheduleAction(name, predicate, task, terminateWhen); + default void addConditionalTask(String name, Supplier condition, Consumer task, Supplier terminateWhen) { + scheduleAction(name, condition, 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 04255b8..b365aa4 100644 --- a/java/noppes/npcs/api/handler/data/actions/IConditionalAction.java +++ b/java/noppes/npcs/api/handler/data/actions/IConditionalAction.java @@ -8,32 +8,32 @@ import java.util.function.Supplier; public interface IConditionalAction extends IAction { /** - * @param predicate supplier checked every tick, if it returns true, task is fired + * @param condition supplier checked every tick, if it returns true, task is fired * @return */ - IConditionalAction setPredicate(Supplier predicate); + IConditionalAction setCondition(Supplier condition); /** * @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done) * @return this action */ - IConditionalAction setTerminationPredicate(Supplier terminateWhen); + IConditionalAction terminateWhen(Supplier terminateWhen); /** - * @param onTermination code to run when the termination predicate returns true + * @param onTermination code to run when the termination condition returns true * @return this action */ - IConditionalAction setTerminationTask(Consumer onTermination); + IConditionalAction onTermination(Consumer onTermination); /** - * @return true if predicate was satisfied and task ran (i.e can be called in termination task to see if original task was executed + * @return true if condition was satisfied and task ran (i.e can be called in termination task to see if original task was executed * then do code based on that, if not return early) */ boolean wasTaskExecuted(); /** * Note: Only for Conditional Actions - * @return how many times this conditional action has tested its predicate + * @return how many times this conditional action has tested its condition */ int getCheckCount(); @@ -45,22 +45,22 @@ public interface IConditionalAction extends IAction { /** - * @param maxChecks maximum times to test predicate before auto‐cancelling + * @param maxChecks maximum times to test condition before auto‐cancelling * @return this action */ IConditionalAction setMaxChecks(int maxChecks); IConditionalAction after(IConditionalAction after); - IConditionalAction after(Supplier predicate, Consumer task); + IConditionalAction after(Supplier condition, Consumer task); - IConditionalAction after(String name, Supplier predicate, Consumer task); + IConditionalAction after(String name, Supplier condition, Consumer task); - IConditionalAction after(Supplier predicate, Consumer task, Supplier terminate); + IConditionalAction after(Supplier condition, Consumer task, Supplier terminate); - IConditionalAction after(String name, Supplier predicate, Consumer task, Supplier terminate); + IConditionalAction after(String name, Supplier condition, Consumer task, Supplier terminate); - IConditionalAction after(Supplier predicate, Consumer task, Supplier terminateWhen, Consumer onTermination); + IConditionalAction after(Supplier condition, Consumer task, Supplier terminateWhen, Consumer onTermination); - IConditionalAction after(String name, Supplier predicate, Consumer task, Supplier terminateWhen, Consumer onTermination); + IConditionalAction after(String name, Supplier condition, Consumer task, Supplier terminateWhen, Consumer onTermination); }