How to cancel a Bukkit-Scheduler

Discussion in 'Bukkit Help' started by Julz_Dev, Apr 23, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Julz_Dev

    Hello Community.

    I have a problem :

    I want to cancel this timer :

    Code:
    public void timer(){
           
            getServer().broadcastMessage("Countdown :");
       
            Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){       
                           
               
                @Override
                public void run(){
                    if(gameBlock == true){
                    countdown--;
                        if(countdown <= 10 && countdown>=0){
                            if(countdown == 0){
                                Bukkit.getServer().broadcastMessage("Die Runde hat begonnen.");
                                clearInventory();
                                saveArea();
                                for(int i = 0;i<redTeam.length;i++){
                                    if(redTeam[i] != null){
                                        redTeam[i].teleport(baseRed);
                                    }
                                }
                                for(int i = 0;i<blueTeam.length;i++){
                                    if(blueTeam[i] != null){
                                        blueTeam[i].teleport(baseBlue);
                                    }
                                }                       
                             //CANCEL HERE !!!
                        }else{
                            Bukkit.getServer().broadcastMessage("[" + countdown + "]");
                        }
                    }else{
                        
                    }
           
                }
                }
               
            }, 0L, 20L);
           
           
        }
    I need help.
    I tried a lot of things.

    Solved :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  2. Offline

    LanteanKnight

    How did you solve this?
     
Thread Status:
Not open for further replies.

Share This Page