Solved Is it possible to use CountDownLatch in PreLoginEvent [BungeeCord]

Discussion in 'Spigot Plugin Development' started by Enotkin, Apr 25, 2017.

  1. Hello, my question about PreLoginEvent in BungeeCord.
    If I create a delay in PreLoginEvent, the entry will be delayed for all or only for one.

    For exmple:
    Code (Text):
        @EventHandler
        public void onPreLogin(PreLoginEvent e) {
            countDownLatch.await();
        }
     
    #1 Enotkin, Apr 25, 2017
    Last edited: Apr 25, 2017
    • Creative Creative x 1
  2. sothatsit

    Patron

    That will wait until the countdown latch has been counted down, blocking the event from completing. I doubt this is a good idea, but I don't know your use case. Given that you have no condition for getting a latch per player, that will indeed block for every player until the latch is counted down.
     
  3. Those events fire in the io thread. So it will lock the io thread.
     
    • Like Like x 1