Hopefully fix discord being killed incorrectly

This commit is contained in:
Business Goose 2022-03-30 00:03:22 +01:00
parent cc00f65e72
commit 82e70bef71
No known key found for this signature in database
GPG key ID: 77DCA801362E9645

View file

@ -193,6 +193,7 @@ public class DiscordBridge {
} }
CountDownLatch shutdownWaiter = new CountDownLatch(1); CountDownLatch shutdownWaiter = new CountDownLatch(1);
Thread t = new Thread(() -> {
DISCORD_API.addLostConnectionListener(lostConnectionEvent -> shutdownWaiter.countDown()); DISCORD_API.addLostConnectionListener(lostConnectionEvent -> shutdownWaiter.countDown());
DISCORD_API.disconnect(); DISCORD_API.disconnect();
@ -200,6 +201,8 @@ public class DiscordBridge {
shutdownWaiter.await(30, TimeUnit.SECONDS); shutdownWaiter.await(30, TimeUnit.SECONDS);
} catch (InterruptedException ignored) { } catch (InterruptedException ignored) {
} }
});
t.start();
} }
} }