mirror of
https://github.com/KAMKEEL/CustomNPC-Plus-API.git
synced 2026-11-27 19:02:55 +00:00
Removed redundant args from creation methods/constructors
This commit is contained in:
1 parent
05c95c96b9
commit
d4ad1450e1
3 files changed
+13
-31
No files matched your search
@@ -94,42 +94,31 @@ public interface IActionManager {
|
|||||||
*/
|
*/
|
||||||
Queue<IAction> getActionQueue();
|
Queue<IAction> getActionQueue();
|
||||||
|
|
||||||
/**
|
|
||||||
* Schedule a “conditional” action: every {@code checkIntervalTicks}, evaluate
|
|
||||||
* the predicate, and as soon as it returns true, fire the action and remove it.
|
|
||||||
*
|
|
||||||
* @param name a unique name for this conditional action
|
|
||||||
* @param checkIntervalTicks number of ticks between each predicate check
|
|
||||||
* @param predicate no-arg boolean supplier deciding when to fire
|
|
||||||
* @param action logic to execute once when predicate first becomes true
|
|
||||||
* @return the action scheduled
|
|
||||||
*/
|
|
||||||
IAction scheduleConditionalAction(String name, int checkIntervalTicks, Supplier<Boolean> predicate, Consumer<IAction> action);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedule a conditional action that gives up after at most maxChecks attempts.
|
* Schedule a conditional action that gives up after at most maxChecks attempts.
|
||||||
*
|
*
|
||||||
* @param name unique name
|
* @param name unique name
|
||||||
* @param checkIntervalTicks ticks between predicate tests
|
* checkIntervalTicks ticks between predicate tests
|
||||||
* @param predicate supplier returning true when it should fire
|
* @param predicate supplier returning true when it should fire
|
||||||
* @param task logic to run once when predicate first becomes true
|
* @param task logic to run once when predicate first becomes true
|
||||||
* @param maxChecks maximum times to test predicate before auto‐cancelling
|
* @ maxChecks maximum times to test predicate before auto‐cancelling
|
||||||
* @return the action scheduled
|
* @return the action scheduled
|
||||||
*/
|
*/
|
||||||
IAction scheduleConditionalAction(String name, int checkIntervalTicks, Supplier<Boolean> predicate, Consumer<IAction> task, int maxChecks);
|
IConditionalAction scheduleConditionalAction(String name, Supplier<Boolean> predicate, Consumer<IAction> task);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedule a conditional action that gives up after at most maxChecks attempts.
|
* Schedule a conditional action that gives up after at most maxChecks attempts.
|
||||||
*
|
*
|
||||||
* @param name unique name
|
* @param name unique name
|
||||||
* @param checkIntervalTicks ticks between predicate tests
|
* @ checkIntervalTicks ticks between predicate tests
|
||||||
* @param predicate supplier returning true when it should fire
|
* @param predicate supplier returning true when it should fire
|
||||||
* @param terminateWhen supplier returning true when it should terminate (gets marked done)
|
* @param terminateWhen supplier returning true when it should terminate (gets marked done)
|
||||||
* @param task logic to run once when predicate first becomes true
|
* @param task logic to run once when predicate first becomes true
|
||||||
* @param maxChecks maximum times to test predicate before auto‐cancelling
|
* @ maxChecks maximum times to test predicate before auto‐cancelling
|
||||||
* @return the action scheduled
|
* @return the action scheduled
|
||||||
*/
|
*/
|
||||||
IAction scheduleConditionalAction(String name, int checkIntervalTicks, Supplier<Boolean> predicate, Supplier<Boolean> terminateWhen, Consumer<IAction> task, int maxChecks);
|
IConditionalAction scheduleConditionalAction(String name, Supplier<Boolean> predicate, Supplier<Boolean> terminateWhen, Consumer<IAction> task);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel (remove) the first queued action with the given name.
|
* Cancel (remove) the first queued action with the given name.
|
||||||
@@ -180,22 +169,15 @@ public interface IActionManager {
|
|||||||
/**
|
/**
|
||||||
* Convenience: create & enqueue a conditional task that re-checks forever.
|
* Convenience: create & enqueue a conditional task that re-checks forever.
|
||||||
*/
|
*/
|
||||||
default void addConditionalTask(String name,
|
default void addConditionalTask(String name, Supplier<Boolean> predicate, Consumer<IAction> task) {
|
||||||
int checkIntervalTicks,
|
scheduleConditionalAction(name, predicate, task);
|
||||||
Supplier<Boolean> predicate,
|
|
||||||
Consumer<IAction> task) {
|
|
||||||
scheduleConditionalAction(name, checkIntervalTicks, predicate, task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience: create & enqueue a conditional task that gives up after maxChecks.
|
* Convenience: create & enqueue a conditional task that gives up after maxChecks.
|
||||||
*/
|
*/
|
||||||
default void addConditionalTask(String name,
|
default void addConditionalTask(String name, Supplier<Boolean> predicate, Supplier<Boolean> terminateWhen, Consumer<IAction> task) {
|
||||||
int checkIntervalTicks,
|
scheduleConditionalAction(name, predicate, terminateWhen, task);
|
||||||
Supplier<Boolean> predicate,
|
|
||||||
Consumer<IAction> task,
|
|
||||||
int maxChecks) {
|
|
||||||
scheduleConditionalAction(name, checkIntervalTicks, predicate, task, maxChecks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IConditionalAction scheduleConditionalAction(IConditionalAction action);
|
IConditionalAction scheduleConditionalAction(IConditionalAction action);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public interface IAction {
|
|||||||
* @param key a string key
|
* @param key a string key
|
||||||
* @param value any object to associate with this action
|
* @param value any object to associate with this action
|
||||||
*/
|
*/
|
||||||
void addData(String key, Object value);
|
IAction addData(String key, Object value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return how many ticks between each invocation of the action callback
|
* @return how many ticks between each invocation of the action callback
|
||||||
@@ -65,7 +65,7 @@ public interface IAction {
|
|||||||
*
|
*
|
||||||
* @param X tick interval (e.g. 1 = every tick, 20 = once per second)
|
* @param X tick interval (e.g. 1 = every tick, 20 = once per second)
|
||||||
*/
|
*/
|
||||||
void setUpdateEveryXTick(int X);
|
IAction setUpdateEveryXTick(int X);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return how many ticks remain before the action begins (initial delay)
|
* @return how many ticks remain before the action begins (initial delay)
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ import noppes.npcs.api.handler.data.IAction;
|
|||||||
|
|
||||||
public interface IConditionalAction extends IAction {
|
public interface IConditionalAction extends IAction {
|
||||||
|
|
||||||
|
IConditionalAction setMaxChecks(int maxChecks);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user