Ok, so I need help making a timer. I looked in other threads but didnt find any answers. Here is what I have: PHP: foreach($this->plugin->getServer()->getLevelByName($this->level)->getPlayers() as $p) { $time = $this->plugin->timer[$this->id]; if(isset($this->plugin->gamePlayers[$p->getName()])) { $p->sendMessage("/> $time.."); --$this->plugin->timer[$this->id]; } } This code is all in a task.php, I use PHP: $this->plugin->getServer()->getScheduler()->scheduleTask(new timer($this->plugin, $this->id, $this->level, $this->task)); in an other task.php to call it. Okay so lets call this 'callTimerTask.php', now in my main file, I call 'callTimerTask.php' with 'scheduleRepeatingTask' with a period of 1 second (or 20 ticks). My problem is that since the '--$this->plugin->timer[$id];' is in a 'foreach', every second it will subtract '2' from '--$this->plugin->timer[$id];' if there are 2 players in the world and then subtract 3 because there are 3 people, and it goes on. So I just want to make a timer that will be shown to the players in a desired world.
Move --$this->plugin->timer[$this->id]; out of the foreach bracket, put the it below the end of foreach