Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int task_id = -1;
- public void iniciar() {
- if(task_id != -1){
- cancelar(); //Cancelar o task antigo caso nao tenha sido cancelado.
- }
- task_id = Bukkit.getScheduler().scheduleSyncRepeatingTask((JavaPlugin) this, new Runnable() {
- public void run() {
- Bukkit.broadcastMessage("§6[EVENTO] §FBLÁBLÁBLÁ");
- }
- }, 1L, 20L);// O 1l é o tempo para o scheduler iniciar, o 20L é o tempo
- // entre as mensagens.
- }
- public void cancelar(){
- Bukkit.getScheduler().cancelTask(task_id);
- task_id = -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement