async · nRTkeQbXT
$players = $sender->getServer()->getOnlinePlayers();
$sender->getServer()->getAsyncPool()->submitTask(new class($players) extends \pocketmine\scheduler\AsyncTask {
	private array $players;

	public function __construct(array $players){
		$this->players = $players;
	}

	public function onRun() : void{
		foreach($this->players as $player)
			$player->sendMessage("async");
	}
});
  • 4

    7/18/2022, 3:54:55 AM