Cancelling login event

Discussion in 'BungeeCord Plugin Development' started by Ad237, Dec 23, 2013.

  1. 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.
    • Winner Winner x 1
    • Friendly Friendly x 1
  2. md_5

    Administrator Developer

    • Like Like x 2
    • Agree Agree x 1
    • Funny Funny x 1

  3. Code (Text):
        public void onLogin(final PreLoginEvent evt) {
            ProxyServer.getInstance().getScheduler().runAsync(plugin, new Runnable() {
                public void run() {
                    //look at me, i am a async database query!!!!
                    evt.setCancelReason("i don't like you!!!!");
    EDIT: md_5 was faster :(
    • Useful Useful x 8
    • Like Like x 1
    • Like Like x 3