Privileges

20.5k Downloads

Usage of blocking methods causing server lockup and crash

keir-nellyer opened this issue ยท 0 comments

commented

There are numerous usages of the method getOfflinePlayer(String) throughout the plugin, a list of them can be viewed here https://github.com/krinsdeath/Privileges/search?utf8=%E2%9C%93&q=getOfflinePlayer&type=Code

Due to the switch to UUIDs in preparation for name changing, Bukkit has switched to storing offline players with their UUID. This means that to get an offline player by their username, a request has to be made to Mojang.

All/most of your calls to getOfflinePlayer(String) are made in the main thread, this means that a web request is being made in the main thread (see here). This can cause lag & hangups for many reasons and result in crashes like this: http://pastebin.com/7mSPHbQw

One possible solution is to make all calls to getOfflinePlayer(String) async.