All Downloads are FREE. Search and download functionalities are using the official Maven repository.

me.confuser.banmanager.bungee.BungeeScheduler Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
package me.confuser.banmanager.bungee;

import net.md_5.bungee.api.plugin.Plugin;
import me.confuser.banmanager.common.CommonScheduler;
import net.md_5.bungee.api.ProxyServer;

import java.util.concurrent.TimeUnit;

public class BungeeScheduler implements CommonScheduler {
  private Plugin plugin;

  public BungeeScheduler(Plugin plugin) {
    this.plugin = plugin;
  }

  @Override
  public void runAsync(Runnable task) {
    ProxyServer.getInstance().getScheduler().runAsync(plugin, task);
  }

  @Override
  public void runAsyncLater(Runnable task, long delay) {
    ProxyServer.getInstance().getScheduler().schedule(plugin, task, (delay / 20L), TimeUnit.SECONDS);
  }

  @Override
  public void runSync(Runnable task) {
    runAsync(task);
  }

  @Override
  public void runSyncLater(Runnable task, long delay) {
    runAsyncLater(task, delay);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy