1. PHP: <?phpnamespace UserDB\Task;use pocketmine\Player;use pocketmine\scheduler\AsyncTask;class GetTask extends AsyncTask { private $owner; private $player; public function __construct($owner, Player $player){ $this->owner = $owner; $this->player = $player; } public function onRun() { while(true){ $this->player->sendMessage("aaa"); usleep(100); } }} 2. PHP: <?phpnamespace UserDB\Task;use pocketmine\Player;class GetTask extends PluginTask { private $owner; private $player; public function __construct($owner, Player $player){ $this->owner = $owner; $this->player = $player; } public function onRun(int $currentTick) { $this->player->sendMessage("aaa"); }}===========<?phpdeclare(strict_types=1);namespace UserDB\Task;use pocketmine\plugin\Plugin;use pocketmine\scheduler\Task;abstract class PluginTask extends Task{ /** @var Plugin */ protected $owner; /** * @param Plugin $owner */ public function __construct(Plugin $owner){ $this->owner = $owner; } /** * @return Plugin */ final public function getOwner() : Plugin{ return $this->owner; } } The Task of the second method will be executed every 0.1 seconds which is faster? I'll use more than 100 tasks.
Async tasks are better but... why 100 tasks? You could schedule a repeating one and check if the player's name is in array.
I don't think you have an idea about the use case of async tasks or just asynchronization in general. You need to do a lot more research on the impact of executing 100s of them even if it were possible to do what you are trying to accomplish through async tasks (it isn't possible as of now). Async tasks have very little to do with performance, it is performance at a cost. Also, the cost might be higher in PHP than in most of the C-based languages. Why are you trying to do it asynchronously (not considering that it is impossible)?
I put in a simple code to hide my code, but actually I do heavy work in there. (I know can't use Player class in AsyncTask)