Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

sheduler task bug

Comments in 'Plugin Development' started by Creeperface, May 26, 2015.

  1. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    When i send message in sheduler sometimes message send 2 times or 3 times why?
  2. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Post the code
  3. Artide
    Offline

    Artide Active Member

    Joined:
    Apr 20, 2015
    Posts:
    214
    Minecraft User:
    Artide5
    You gotta return false.
  4. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    message "bedwars starting in 50 seconds" displays 2 times or 3 times.
    PHP:
    public function onRun($ticks) {  
            
    $inGamePlayers array_merge($this->getPlugIn()->blueTeamPlayers$this->getPlugIn()->redTeamPlayers$this->getPlugIn()->yellowTeamPlayers$this->getPlugIn()->greenTeamPlayers$this->getPlugIn()->lobbyPlayers);
            
    $inGamePlayers1 array_merge($this->getPlugIn()->blueTeamPlayers$this->getPlugIn()->redTeamPlayers$this->getPlugIn()->yellowTeamPlayers$this->getPlugIn()->greenTeamPlayers);
            if(
    count($inGamePlayers) >= 12 && $this->getPlugIn()->ingame == false){
                
    $this->getPlugIn()->starting true;
            }
            if(
    count($inGamePlayers) <= && $this->getPlugIn()->ingame == false){
                
    $this->getPlugIn()->starting false;
            }
                if (
    $this->getPlugIn()->starting == true) {  
                    
    $this->cas0++;
                    if(
    $this->cas0 == 4){
                        foreach(
    $inGamePlayers as $p){
                            
    $p->sendMessage(TextFormat::AQUA."Bedwars starting in 50 seconds");
                        }
                    }

                    if(
    $this->cas0 == 5){
                        foreach(
    $inGamePlayers as $p){
                            
    $p->sendPopup(TextFormat::AQUA."Bedwars starting in 49 seconds");
                        }
                    }
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Wat
    Do you know what 'return false' means?
    The most likely explanation is that you are handling the sessions (i.e. what team they are) incorrectly, so a player exists in multiple "team" arrays. Mind posting more code?
    iksaku likes this.

Share This Page

Advertisement