pocketmine\scheduler\AsyncTask::onCompletion PHP Method

onCompletion() public method

Actions to execute when completed (on main thread) Implement this if you want to handle the data in your AsyncTask after it has been processed
public onCompletion ( Server $server ) : void
$server pocketmine\Server
return void
    public function onCompletion(Server $server)
    {
    }

Usage Example

 public function collectAsyncTask(AsyncTask $task)
 {
     if ($task->isFinished() and !$task->isCompleted()) {
         --$this->asyncTasks;
         $task->onCompletion(Server::getInstance());
         $task->setCompleted();
         unset($this->asyncTaskStorage[$task->getTaskId()]);
         return true;
     }
     return false;
 }