You often see people using SQL in a separate thread so that queries that take longer can be executed without lagging the server but if I want for example check if a player is banned, or what rank he is when logging in I can't really do that in another thread as I need to know that instant if he should be kicked or what colour to make his name but I can't think of a soulution.
Nogtail Well, does it matter if he gets kicked immediately or after 2 ticks? It doesn't. Nor does it matter that much anywhere else. If it takes a second or so then what? Nothing bad will happen and if it takes a bit for people to get their permissions/rights or whatever on join, then it's nothing problematic either.
In order to use the bukkit API from a separate thread you can schedule a sync task that does what you want. EDIT: Or, if you want something directly, store the data in ram and access that data whenever you need to, then have a repeating async task that saves/loads all of your buffered data in to the database.
It would be a pain if a user repeatedly joined and spammed a message before being kicked and for chat related uses if the result is not cached the user would experience delay when sending messages. That would work quite well but for larger servers where there tens or hundreds of thousands of player files it would not work so well. EDIT by Moderator: merged posts, please use the edit button instead of double posting.