I am creating a simple custom banning plugin for my proxy server but I have one problem. I want to be able to run the database queries async so it doesn't lag the server but if I do this then I can't cancel the event. Does Bungee have an async login event or something I can use? If not can you suggest a way of doing this. Thanks.
https://github.com/SpigotMC/BungeeC...ava/net/md_5/bungee/api/event/LoginEvent.java Please note that you should not run your database code in the event. Use event.registerIntent(myplugin); Then schedule your code to runAsync with the scheduler. At the end of the scheduler runnable, use event.completeIntent(myplugin);
Code (Text): @EventHandler public void onLogin(final PreLoginEvent evt) { evt.registerIntent(plugin); ProxyServer.getInstance().getScheduler().runAsync(plugin, new Runnable() { @Override public void run() { //look at me, i am a async database query!!!! evt.setCancelReason("i don't like you!!!!"); evt.setCancelled(true); evt.completeIntent(plugin); } }); } EDIT: md_5 was faster