I have an array that gets data added to it from an API inside an async task. I'd like to get this data and use it in my listener file so I can store the data for future use, and call it without calling the API, kind of like creating your own database for something that is called often. Information about the variable that I want to get: Variable is simply: public $data; Inside the class, Check, extending the Async Task. I would need to call it from inside a function on the Class that extends Listener Any help is appreciated, thanks!
on async on complete use the provided server call get pluginmanager then call get plugin provide it your name now you can pass the data from the async task
Can you give me an example of that, I had the part you just mentioned but I wasn't able to get the data to it It probably matters how I call the task, which is $this->getServer()->getAsyncPool()->submitTask(new SOMETHING($array, $string));
Figured it out thanks to looking through some example code, I was fixated on getting the data by returning but what I should have done is passed the data to a function. Plugin I made works perfectly now! Anyways thanks for helping it was what I needed to do I just didn't understand what u meant
When I saw the commit for that I asked the same thing to myself lol Edit https://github.com/pmmp/ExamplePlugin/blob/master/src/ExamplePlugin/BroadcastTask.php Pass the server as an argument to the task.