mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-22 17:14:58 +00:00
Hopefully fix discord being killed incorrectly
This commit is contained in:
parent
b984b700e0
commit
d033b96376
2 changed files with 11 additions and 0 deletions
1
pom.xml
1
pom.xml
|
@ -51,6 +51,7 @@
|
|||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -24,6 +24,8 @@ import org.javacord.api.event.message.MessageCreateEvent;
|
|||
import org.javacord.api.event.message.MessageEvent;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class DiscordBridge {
|
||||
|
@ -189,7 +191,15 @@ public class DiscordBridge {
|
|||
CHANNEL.sendMessage(sanitizeMessage(message)).get();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
CountDownLatch shutdownWaiter = new CountDownLatch(1);
|
||||
|
||||
DISCORD_API.addLostConnectionListener(lostConnectionEvent -> shutdownWaiter.countDown());
|
||||
DISCORD_API.disconnect();
|
||||
|
||||
try {
|
||||
shutdownWaiter.await(30, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue