BuyCraft ported for PocketMine-MP
- Fixed a segfault which occurred when executing certain asynchronous tasks on new PocketMine builds. This is a hacky temporary fix and it hopefully will be improved in the future.
- Added debugging tools to make finding API issues faster.
- Temporary fix to the BuyCraft API issues, I will document the fix further on my blog.
- Refactored cURL requests to be encapsulated in an HTTPUtils.
- Fixes class loading issue which prevented anything from working properly. Thanks to @kennethgomad01 for reporting this issue.
Fixed a major memory leak. This issue manifested itself in memory allocation crashes and server instability. Thanks to @ijoshuahd for reporting!
What was happening?
(Almost) Everything in BuyCraft runs asynchronously so as to not block the main thread. When working with an AsyncTask it is important to remove all references to the Server object and the main thread. I have dealt with AsyncTasks before so I was sure to prevent this by only storing pieces of data like "is the plugin...
- Added /buy and all associated functionality.
- Did some other improvements.
- The pending users checker (which send requests every 2 seconds) now sends requests using an AsyncTask.
- When an error happens during a fetch task (which can happen if the API is having issues) the error will happen silently and the plugin will retry.