Add few try-catches

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-11-17 09:33:11 +01:00
parent 785bcb8b6d
commit 69e9b31fa4

View File

@ -44,10 +44,18 @@ public final class Worker extends MinestomThread {
public void run() {
while (server.isOpen()) {
try {
this.queue.drain(Runnable::run);
try {
this.queue.drain(Runnable::run);
} catch (Exception e) {
MinecraftServer.getExceptionManager().handleException(e);
}
// Flush all connections if needed
if (flush.compareAndSet(true, false)) {
connectionMap.values().forEach(PlayerSocketConnection::flushSync);
try {
connectionMap.values().forEach(PlayerSocketConnection::flushSync);
} catch (Exception e) {
MinecraftServer.getExceptionManager().handleException(e);
}
}
// Wait for an event
this.selector.select(key -> {