use of net.aufdemrand.denizencore.scripts.queues.core.Delayable in project Denizen-For-Bukkit by DenizenScript.
the class QueueCommand method execute.
@Override
public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
ScriptQueue queue = (ScriptQueue) scriptEntry.getObject("queue");
Action action = (Action) scriptEntry.getObject("action");
Duration delay = (Duration) scriptEntry.getObject("delay");
// Debugger
dB.report(scriptEntry, getName(), queue.debug() + aH.debugObj("Action", action.toString()) + (action == Action.DELAY ? delay.debug() : ""));
switch(action) {
case CLEAR:
queue.clear();
return;
case STOP:
queue.clear();
queue.stop();
return;
case PAUSE:
if (queue instanceof Delayable) {
((Delayable) queue).setPaused(true);
} else {
queue.forceToTimed(new Duration(1L)).setPaused(true);
}
return;
case RESUME:
if (queue instanceof Delayable) {
((Delayable) queue).setPaused(false);
}
return;
case DELAY:
if (queue instanceof Delayable) {
((Delayable) queue).delayFor(delay);
} else {
queue.forceToTimed(delay);
}
return;
}
}
use of net.aufdemrand.denizencore.scripts.queues.core.Delayable in project Denizen-For-Bukkit by DenizenScript.
the class WaitCommand method execute.
@Override
public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
ScriptQueue queue = (ScriptQueue) scriptEntry.getObject("queue");
Duration delay = (Duration) scriptEntry.getObject("delay");
dB.report(scriptEntry, getName(), aH.debugObj("queue", queue.id) + delay.debug());
// Tell the queue to delay
if (queue instanceof Delayable) {
((Delayable) queue).delayFor(delay);
} else {
scriptEntry.setInstant(false);
dB.echoDebug(scriptEntry, "Forcing queue " + queue.id + " into a timed queue...");
queue.forceToTimed(delay);
}
}
Aggregations