Cancel connection / Proxy ping

Discussion in 'BungeeCord Plugin Development' started by GurkenWasser, Feb 4, 2020.

  1. Hello everyone,

    I just want to cancel a ping from certain IP. With this I want to cancel the connection. I know the PostLoginEvent Method, but I need to cancel the IP before the player will connect.

    To cancel I used this code:

    Code (Text):
        @EventHandler
        public void onPingBlock(ProxyPingEvent e) {
           
            ServerPing response = new ServerPing();
            e.setResponse(null);

        }
    Is this a good way to block the connection? Or is there any other method?

    Thank you.

    Best Regards
     
  2. In latest bungee ConnectionInitEvent was added, which is called earlier than the proxy ping one. Consider using that.