Error: "Cannot instantiate abstract class pocketmine\scheduler\Task" (EXCEPTION) in "plugins/Key_v1/src/key/Main" at line 24 is giving this error.
<?php namespace key; use pocketmine\Player; use pocketmine\plugin\PluginBase; use pocketmine\utils\Config; use pocketmine\scheduler\Task; use pocketmine\command\Command; use pocketmine\command\CommandSender; use pocketmine\command\ConsoleCommandSender; class Main extends PluginBase{ const PREFIX = "§9[§6#§9]"; const COUNT_KEY = 8; public function onEnable(){ @mkdir($this->getDataFolder()); $this->time = new Config($this->getDataFolder()."time.yml", Config::YAML); $this->data = new \SQLite3($this->getDataFolder()."keys.db"); $this->pureperms = $this->getServer()->getPluginManager()->getPlugin("PurePerms"); $this->getScheduler()->scheduleRepeatingTask(new Task([$this, "updateKey"]), 20*30); $this->data->query("CREATE TABLE if not exists keys( key TEXT PRIMARY KEY NOT NULL, type TEXT NOT NULL, active INT NOT NULL );"); } public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args) : bool{ switch($cmd->getName()){ case "gerarkey": if(!isset($args[0])){ $sender->sendMessage(self:REFIX." §7Use §a/gerarkey §8[§b<mensal> ou <eterno>§8]"); }else{ if(strtolower($args[0])=="mensal"){ $key = $this->gerarkey(self::COUNT_KEY); $sender->sendMessage(self:REFIX." §7Key gerada com sucesso: §8[ §b {$key} §8]"); $this->addKey($key, "mensal"); }else if(strtolower($args[0])=="eterno"){ $key = $this->gerarkey(self::COUNT_KEY); $sender->sendMessage(self:REFIX." §7Key gerada com sucesso: §8[§b {$key} §8]"); $this->addKey($key, "eterno"); }else{ $sender->sendMessage(self:REFIX."§7Use §a/gerarkey §8[§b<mensal> ou <eterno>§8]"); } } break; case "removerkey": if(!isset($args[0])){ $sender->sendMessage(self:REFIX." §7Use §a/remkey <key> §7!"); }else{ if($this->existsKey($args[0])){ $this->remKey($args[0]); $sender->sendMessage(self:REFIX." §7Key removida com sucesso!"); }else{ $sender->sendMessage(self:REFIX." §7Não existe nenhuma key com este nome!"); } } break; case "ativar": if(!isset($args[0])){ $sender->sendMessage(self:REFIX." §7Use §8[ §b/ativarkey <key> §8]"); }else{ if($this->existsKey($args[0])){ if($this->isActive($args[0])){ $sender->sendMessage(self:REFIX." §7Essa key ja foi ativada!"); }else{ $sender->sendMessage(self:REFIX." §aAguarde..."); $this->activeKey($sender, $args[0]); } }else{ $sender->sendMessage(self:REFIX." §7Não existe nenhuma key com este nome!"); } } break; } return true; } public function existsKey(string $key){ $res = $this->data->query("SELECT * FROM keys WHERE key = '$key'"); $data = $res->fetchArray(SQLITE3_ASSOC); if(isset($data["key"]) && $data["key"] == $key) return true; else return false; } public function gerarkey(int $count){ $gr = ""; $pl = "abcdefghijklmnopqrstuvwxyz0123456789"; $pla = str_split($pl); for($i = 0; $i < $count; $i++){ $ra = array_rand($pla); $gr .= "".$pla[$ra]; } return $gr; } public function addKey(string $key, string $type){ if(!$this->existsKey($key)){ $this->data->query("INSERT INTO keys(key, type, active) VALUES ('$key', '$type', 0)"); } } public function remKey(string $key){ if($this->existsKey($key)){ $this->data->query("DELETE * FROM keys WHERE key = '$key'"); } } public function isActive(string $key){ if($this->existsKey($key)){ $res = $this->data->query("SELECT * FROM keys WHERE key = '$key'"); $data = $res->fetchArray(SQLITE3_ASSOC); if($data["active"]==0) return false; else return true; }else{ return false; } } public function activeKey(Player $p, string $key){ if($this->existsKey($key)&&!$this->isActive($key)){ if($this->pureperms->getUserDataMgr()->getNode($p, "group")=="Vip"){ $p->sendMessage(self:REFIX." §7Você ja tem §6§lVIP§r §7no servidor!"); return; } $name = strtolower($p->getName()); $this->getServer()->dispatchCommand(new ConsoleCommandSender(), "setgroup {$name} Vip"); $this->data->query("UPDATE keys SET active = 1 WHERE key = '$key'"); $res = $this->data->query("SELECT * FROM keys WHERE key = '$key'"); $data = $res->fetchArray(SQLITE3_ASSOC); $p->sendMessage(self:REFIX." §aVocê ativou seu vip {$data["type"]} com sucesso!"); if($data["type"]=="mensal"){ date_default_timezone_set("America/Sao_Paulo"); $time = (time() + 2592000); $this->time->set($name, "{$time}"); $this->time->save(); $p->sendMessage(self:REFIX." §7O seu §bVIP§7 vai acabar em: §f".date("d/m/Y", $time)."§7!"); } foreach($this->getServer()->getOnlinePlayers() as $pl){ $pl->addTitle("§6{$p->getName()} §7tornou-se §b§lVIP§r"); } } } public function updateKey(){ foreach($this->getServer()->getOnlinePlayers() as $p){ $name = strtolower($p->getName()); if($this->time->exists($name)){ date_default_timezone_set("America/Sao_Paulo"); $time = $this->time->get($name); if(time()>=$time){ $p->sendMessage(self:REFIX." §7Seu §6§lVIP §r§7mensal acabou "); $this->getServer()->dispatchCommand(new ConsoleCommandSender(), "setgroup {$name} Guest"); $this->time->remove($name); $this->time->save(); } } } } }