How do i stop a task i have looked in this forum but havent found anything that works with my code PHP: <?phpnamespace besher\timer;use besher\timer\Main;use pocketmine\scheduler\Task;use pocketmine\level\sound\ClickSound;use pocketmine\level\sound\BlazeShootSound;class SecondTask extends Task{ public $time = 10; // Count down set to 10 public function __construct(Main $main){ $this->main = $main; } public function onRun(int $currentTick){ foreach($this->main->getServer()->getOnlinePlayers() as $player){ $this->time--; $player->sendTip("Time: ".$this->time); $player->getLevel()->addSound(new ClickSound($player)); if($this->time == 1) $player->getLevel()->addSound(new BlazeShootSound($player)); if($this->time == 0) $this->plugin->getScheduler()->cancelTask($this->getTaskId()); } }} That just makes the server crash
PHP: <?phpnamespace besher\timer;use besher\timer\Main;use pocketmine\scheduler\Task;use pocketmine\level\sound\ClickSound;use pocketmine\level\sound\BlazeShootSound;class SecondTask extends Task{ public $time = 10; // Count down set to 10 public function __construct(Main $main){ $this->main = $main; } public function onRun(int $currentTick){ foreach($this->main->getServer()->getOnlinePlayers() as $player){ $this->time--; $player->sendTip("Time: ".$this->time); $player->getLevel()->addSound(new ClickSound($player)); if($this->time == 1) $player->getLevel()->addSound(new BlazeShootSound($player)); if($this->time == 0) $this->main->getScheduler()->cancelTask($this->getTaskId()); } }}