mirror of
https://github.com/KAMKEEL/CustomNPC-Plus-API.git
synced 2026-11-16 22:15:07 +00:00
INFINITE OVERLOADS !!!!!
This commit is contained in:
1 parent
aa1177ffb2
commit
c0aae432d6
3 files changed
+74
-30
No files matched your search
@@ -26,6 +26,8 @@ public interface IActionManager {
|
||||
*/
|
||||
IAction create(String name, int maxDuration, int delay, Consumer<IAction> action);
|
||||
|
||||
IAction create(int maxDuration, int delay, Consumer<IAction> task);
|
||||
|
||||
IAction create(String name, int delay, Consumer<IAction> t);
|
||||
|
||||
IAction create(int delay, Consumer<IAction> t);
|
||||
@@ -165,6 +167,8 @@ public interface IActionManager {
|
||||
*/
|
||||
IAction scheduleAction(String name, int maxDuration, int delay, Consumer<IAction> task);
|
||||
|
||||
IAction scheduleAction(int maxDuration, int delay, Consumer<IAction> task);
|
||||
|
||||
/**
|
||||
* Insert an action at a specific position in the queue.
|
||||
*
|
||||
@@ -202,6 +206,39 @@ public interface IActionManager {
|
||||
*/
|
||||
Queue<IAction> getActionQueue();
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
// Conditionals
|
||||
|
||||
/**
|
||||
* Schedule a conditional action that gives up after at most maxChecks attempts.
|
||||
*
|
||||
* @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(Supplier<Boolean> condition, Consumer<IAction> task);
|
||||
|
||||
/**
|
||||
* Schedule a conditional action that gives up after at most maxChecks attempts.
|
||||
*
|
||||
* @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(Supplier<Boolean> condition, Consumer<IAction> task, Supplier<Boolean> terminateWhen);
|
||||
|
||||
/**
|
||||
* Schedule a conditional action that gives up after at most maxChecks attempts.
|
||||
*
|
||||
* @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 condition returns true
|
||||
* @return the action scheduled
|
||||
*/
|
||||
IConditionalAction scheduleAction(Supplier<Boolean> condition, Consumer<IAction> task, Supplier<Boolean> terminateWhen, Consumer<IAction> onTermination);
|
||||
|
||||
/**
|
||||
* Schedule a conditional action that gives up after at most maxChecks attempts.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package noppes.npcs.api.handler.data;
|
||||
|
||||
import noppes.npcs.api.handler.IActionManager;
|
||||
import noppes.npcs.api.handler.data.actions.IConditionalAction;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
@@ -154,23 +155,6 @@ 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<IAction> task);
|
||||
|
||||
IAction parallel(int delay, Consumer<IAction> task);
|
||||
|
||||
IAction parallel(String name, Consumer<IAction> task);
|
||||
|
||||
IAction parallel(String name, int startAfterTicks, Consumer<IAction> task);
|
||||
|
||||
IAction parallel(String name, int maxDuration, int delay, Consumer<IAction> t);
|
||||
|
||||
/**
|
||||
* Enqueue another action immediately after this one.
|
||||
*
|
||||
@@ -204,4 +188,40 @@ public interface IAction {
|
||||
IAction before(String name, Consumer<IAction> t);
|
||||
|
||||
IAction before(Consumer<IAction> t);
|
||||
|
||||
/**
|
||||
* Enqueue an IConditionalAction on the conditional chain
|
||||
*
|
||||
* @param after the scheduled IConditionalAction
|
||||
*/
|
||||
IConditionalAction conditional(IConditionalAction after);
|
||||
|
||||
IConditionalAction conditional(Supplier<Boolean> condition, Consumer<IAction> task);
|
||||
|
||||
IConditionalAction conditional(String name, Supplier<Boolean> condition, Consumer<IAction> task);
|
||||
|
||||
IConditionalAction conditional(Supplier<Boolean> condition, Consumer<IAction> task, Supplier<Boolean> terminate);
|
||||
|
||||
IConditionalAction conditional(String name, Supplier<Boolean> condition, Consumer<IAction> task, Supplier<Boolean> terminate);
|
||||
|
||||
IConditionalAction conditional(Supplier<Boolean> condition, Consumer<IAction> task, Supplier<Boolean> terminateWhen, Consumer<IAction> onTermination);
|
||||
|
||||
IConditionalAction conditional(String name, Supplier<Boolean> condition, Consumer<IAction> task, Supplier<Boolean> terminateWhen, Consumer<IAction> onTermination);
|
||||
|
||||
/**
|
||||
* Enqueue another IAction on the parallel chain which starts firing simultaneously as this.
|
||||
*
|
||||
* @param after the scheduled parallel action
|
||||
*/
|
||||
IAction parallel(IAction after);
|
||||
|
||||
IAction parallel(Consumer<IAction> task);
|
||||
|
||||
IAction parallel(int delay, Consumer<IAction> task);
|
||||
|
||||
IAction parallel(String name, Consumer<IAction> task);
|
||||
|
||||
IAction parallel(String name, int startAfterTicks, Consumer<IAction> task);
|
||||
|
||||
IAction parallel(String name, int maxDuration, int delay, Consumer<IAction> t);
|
||||
}
|
||||
@@ -57,17 +57,4 @@ public interface IConditionalAction extends IAction {
|
||||
*/
|
||||
IConditionalAction setMaxChecks(int maxChecks);
|
||||
|
||||
IConditionalAction after(IConditionalAction after);
|
||||
|
||||
IConditionalAction after(Supplier<Boolean> condition, Consumer<IAction> task);
|
||||
|
||||
IConditionalAction after(String name, Supplier<Boolean> condition, Consumer<IAction> task);
|
||||
|
||||
IConditionalAction after(Supplier<Boolean> condition, Consumer<IAction> task, Supplier<Boolean> terminate);
|
||||
|
||||
IConditionalAction after(String name, Supplier<Boolean> condition, Consumer<IAction> task, Supplier<Boolean> terminate);
|
||||
|
||||
IConditionalAction after(Supplier<Boolean> condition, Consumer<IAction> task, Supplier<Boolean> terminateWhen, Consumer<IAction> onTermination);
|
||||
|
||||
IConditionalAction after(String name, Supplier<Boolean> condition, Consumer<IAction> task, Supplier<Boolean> terminateWhen, Consumer<IAction> onTermination);
|
||||
}
|
||||
Reference in new issue
Block a user