Console output: Server thread/CRITICAL Error: "Call to undefined method pocketmine\Server::scheduleDelayedTask() Main.php PHP: <?phpnamespace DelayedCommands;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\Player;use pocketmine\Server;class Main extends PluginBase implements Listener{ public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getServer()->scheduleDelayedTask(new SendCommandTask($this), 400); } } SendCommandTask.php PHP: <?phpnamespace DelayedCommands;use pocketmine\plugin\Plugin;use pocketmine\scheduler\PluginTask;use pocketmine\Player;use pocketmine\Server;use pocketmine\command\ConsoleCommandSender;use pocketmine\command\Command;use pocketmine\command\CommandSender;class SendCommandTask extends PluginTask{ public function onRun(int $currentTick){ $this->getServer()->dispatchCommand(new ConsoleCommandSender(), "say hi"); }}
PHP: $this->getScheduler()->scheduleDelayedTask(new SendCommandTask(), 400); Change PluginTask to Task Change $this->getServer() inside onRun to Server::getInstance()