Add support for delaying commands.

This commit is contained in:
DNx
2018-01-26 14:28:02 +07:00
parent dfb2d72d28
commit f7e9ac9685
3 changed files with 40 additions and 8 deletions
@@ -9,6 +9,8 @@ public class Command {
private String command;
/** The executor of the command. */
private Executor executor = Executor.PLAYER;
/** Delay before executing the command (in ticks) */
private long delay = 0;
/**
* Default constructor (for bean mapping).
@@ -27,6 +29,19 @@ public class Command {
this.executor = executor;
}
/**
* Constructor.
*
* @param command the command
* @param executor the executor of the command
* @param delay the delay (in ticks) before executing command
*/
public Command(String command, Executor executor, long delay) {
this.command = command;
this.executor = executor;
this.delay = delay;
}
public String getCommand() {
return command;
}
@@ -43,6 +58,14 @@ public class Command {
this.executor = executor;
}
public long getDelay() {
return delay;
}
public void setDelay(int delay) {
this.delay = delay;
}
@Override
public String toString() {
return command + " (" + executor + ")";