Search in sources :

Example 1 with ScheduledTask

use of com.velocitypowered.api.scheduler.ScheduledTask in project ScreamingLib by ScreamingSandals.

the class VelocityTaskInitializer method cancel.

@Override
public void cancel(TaskerTask task) {
    final ScheduledTask toCancel = task.getTaskObject();
    toCancel.cancel();
}
Also used : ScheduledTask(com.velocitypowered.api.scheduler.ScheduledTask)

Example 2 with ScheduledTask

use of com.velocitypowered.api.scheduler.ScheduledTask in project LuckPerms by lucko.

the class VelocitySchedulerAdapter method asyncRepeating.

@Override
public SchedulerTask asyncRepeating(Runnable task, long interval, TimeUnit unit) {
    ScheduledTask t = this.bootstrap.getProxy().getScheduler().buildTask(this.bootstrap, task).delay((int) interval, unit).repeat((int) interval, unit).schedule();
    this.tasks.add(t);
    return t::cancel;
}
Also used : ScheduledTask(com.velocitypowered.api.scheduler.ScheduledTask)

Example 3 with ScheduledTask

use of com.velocitypowered.api.scheduler.ScheduledTask in project LuckPerms by lucko.

the class VelocitySchedulerAdapter method asyncLater.

@Override
public SchedulerTask asyncLater(Runnable task, long delay, TimeUnit unit) {
    ScheduledTask t = this.bootstrap.getProxy().getScheduler().buildTask(this.bootstrap, task).delay((int) delay, unit).schedule();
    this.tasks.add(t);
    return t::cancel;
}
Also used : ScheduledTask(com.velocitypowered.api.scheduler.ScheduledTask)

Example 4 with ScheduledTask

use of com.velocitypowered.api.scheduler.ScheduledTask in project ADP-Core by AlessioDP.

the class ADPVelocityScheduler method scheduleAsyncRepeating.

@Override
public CancellableTask scheduleAsyncRepeating(@NotNull Runnable runnable, long delay, long period, TimeUnit unit) {
    ADPVelocityBootstrap velocityPlugin = ((ADPVelocityBootstrap) plugin.getBootstrap());
    // Use Velocity scheduler instead of mine
    ScheduledTask future = velocityPlugin.getServer().getScheduler().buildTask(velocityPlugin, runnable).delay(delay, unit).repeat(period, unit).schedule();
    return future::cancel;
}
Also used : ADPVelocityBootstrap(com.alessiodp.core.velocity.bootstrap.ADPVelocityBootstrap) ScheduledTask(com.velocitypowered.api.scheduler.ScheduledTask)

Example 5 with ScheduledTask

use of com.velocitypowered.api.scheduler.ScheduledTask in project ADP-Core by AlessioDP.

the class ADPVelocityScheduler method scheduleAsyncLater.

@Override
public CancellableTask scheduleAsyncLater(@NotNull Runnable runnable, long delay, TimeUnit unit) {
    ADPVelocityBootstrap velocityPlugin = ((ADPVelocityBootstrap) plugin.getBootstrap());
    // Use Velocity scheduler instead of mine
    ScheduledTask future = velocityPlugin.getServer().getScheduler().buildTask(velocityPlugin, runnable).delay(delay, unit).schedule();
    return future::cancel;
}
Also used : ADPVelocityBootstrap(com.alessiodp.core.velocity.bootstrap.ADPVelocityBootstrap) ScheduledTask(com.velocitypowered.api.scheduler.ScheduledTask)

Aggregations

ScheduledTask (com.velocitypowered.api.scheduler.ScheduledTask)7 ADPVelocityBootstrap (com.alessiodp.core.velocity.bootstrap.ADPVelocityBootstrap)2