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

what wrongs

Comments in 'Plugin Development' started by Ritch, Mar 23, 2016.

  1. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    PHP:
            public function onRun($tick)  {
            if(
    $this->plugin->min 0)  {
                
    $this->plugin->min--;
                foreach(
    Server::getInstance()->getOnlinePlayers() as $player) {
                    
    $level $player->getLevel()->getName();
                      if(
    $level === "test" $this->plugin->start $this->plugin->gameStarted === true){
                           
    $player->sendMessage("[GAME] finish in ".$this->plugin->min.":00");
                                     }else{
                                      
    $this->plugin->min 2;                           
                                       
    $this->plugin->getServer()->loadLevel("test");
                                       
    $Players $this->plugin->getServer()->getLevelByName("test")->getPlayers();
                                       if(
    count($Players) > $this->plugin->start 1){
                                      
    $this->plugin->gameStarted true;
                                     }else{
                            if(
    count($Players) > $this->plugin->min)
                                foreach(
    $Players as $pl){
                                
    $pl->sendMessage("§l§6Your are won !");
                                
    $pl->teleport($this->plugin->getServer()->getDefaultLevel()->getSafeSpawn(), 00);
                               
    $name $this->plugin->cfg->get("reset_map");
                         if (!
    $this->plugin->getServer()->getLevelByName($name) instanceof Level) {
                               
    $this->plugin->getServer()->unloadLevel($name);
                                    
    $this->deleteDirectory($this->plugin->getServer()->getDataPath() . "/worlds/" $name);
                                    
    $this->copymap($this->plugin->getDataFolder() . "/maps/" $name$this->plugin->getServer()->getDataPath() . "/worlds/" $name);
                                    
    $this->plugin->getServer()->loadLevel($name);
                                       }
                                    }
                                }
                    }
                       }
                  }
  2. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    Mind pointing us the error line?
    applqpak and Survingo like this.
  3. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    The Line with if(count($Players) >1){ not Executed why ?
  4. TheDeibo
    Offline

    TheDeibo Notable Member Plugin Developer

    Joined:
    Sep 8, 2014
    Posts:
    692
    Plugins:
    1
    Minecraft User:
    TheDeibo
    DOes it give a crash, or a a detailed console error? ( this would be helpful for us to debug the code )
    Ritch and Vaivez66 like this.
  5. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    I not have crash ... This code not work... Or i have problem with count() ... I' dont know.. :(

Share This Page

Advertisement