Just testing v2.3 for someone on the Bukkit forums.
Just some pointers, which could make this plugin so much better :)
Your version checker should NOT run in the main thread. You need to run it in a async task else the whole server freezes while its trying to connect to your web-server (Which will always include a massive delay, unless your running your server right next to your web server.)
You should not need create a new Connection every time you need one, it takes about 1ms to make connections to the SQLite db which is madness. Try caching the connection for a certain amount of time. (Maybe make it expire after about 10-20 ms of not being used)
Also, if you did not know already, player.sendMessage("My Message"); can be called in separate threads. So, you can actually offload all of your commands onto a separate thread (After they have finished checking for stuff like permissions)
You could do that by creating a queue of commands (Just storing the onCommand arguments in a queue) and then running them in a separate thread.
Another idea to speed things up (which might be easier to implement than the above ideas) is to use a memory sqlite db as storage, and periodically update the MySQL/SQLite databases with changes in async. That way you don't have to worry about running a heap of async tasks. And reading/writing from the memory sqlite db is pretty much instant.
- 3 comments