mirror of
https://github.com/KAMKEEL/CustomNPC-Plus-API.git
synced 2026-11-15 18:24:44 +00:00
Refactored setUpdateEveryXTick to updateEvery
Added getMaxCount(), once() and times(int n)
This commit is contained in:
1 parent
16c3f64184
commit
abb8c7bb30
1 file changed
+31
-6
@@ -26,7 +26,7 @@ public interface IAction {
|
||||
IActionManager getManager();
|
||||
|
||||
/**
|
||||
* @return how many times this action’s {@code action.accept(this)} callback has run (or how many times task ran)
|
||||
* @return how many times this action’s task has been executed
|
||||
*/
|
||||
int getCount();
|
||||
|
||||
@@ -41,15 +41,40 @@ public interface IAction {
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return the maximum number of ticks this action is allowed to run before auto-terminating
|
||||
* @return the maximum number of ticks this action is allowed to run before auto marking done
|
||||
*
|
||||
* P.S: If max duration is reached and this IAction's thread (created using {@link #threadify()}) is paused by any of the pausing methods,
|
||||
* the thread is forcibly resumed and finishes the task execution.
|
||||
*/
|
||||
int getMaxDuration();
|
||||
|
||||
/**
|
||||
* @param x max duration
|
||||
* default: -1, infinite
|
||||
* @return
|
||||
*/
|
||||
IAction setMaxDuration(int x);
|
||||
|
||||
/**
|
||||
* @return the maximum number of counts this action is allowed to run before auto marking done
|
||||
*/
|
||||
int getMaxCount();
|
||||
|
||||
/**
|
||||
* @param n max count, task auto marks done after running for n counts
|
||||
* default: -1, infinite
|
||||
* @return
|
||||
*/
|
||||
IAction times(int n);
|
||||
|
||||
/**
|
||||
* Execute task only once, mark done
|
||||
* equivalent to times(1)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IAction once();
|
||||
|
||||
/**
|
||||
* Mark this action as complete and de-schedules it from its queue.
|
||||
* Forcibly resumes action if paused or had its thread slept with the IAction pausing methods.
|
||||
@@ -91,14 +116,14 @@ public interface IAction {
|
||||
* @return how many ticks between each execution of the action's task
|
||||
* Default is 5 ticks (4 times per second)
|
||||
*/
|
||||
int getUpdateEveryXTick();
|
||||
int getUpdateEvery();
|
||||
|
||||
/**
|
||||
* Set how many ticks between each invocation of the action callback.
|
||||
* Set how many ticks between each execution of the action task.
|
||||
*
|
||||
* @param X tick interval (e.g. 1 = every tick, 20 = once per second)
|
||||
* @param ticks tick interval (e.g. 1 = every tick, 20 = once per second)
|
||||
*/
|
||||
IAction setUpdateEveryXTick(int X);
|
||||
IAction updateEvery(int ticks);
|
||||
|
||||
/**
|
||||
* @return how many ticks remain before the action begins (initial delay)
|
||||
|
||||
Reference in new issue
Block a user