Suppress some really annoying spam

This commit is contained in:
Andrew Steinborn
2020-06-23 07:56:19 -04:00
parent 9dda0ba9dd
commit df82c0b566

View File

@@ -205,19 +205,32 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
*/
public void closeWith(Object msg) {
if (channel.isActive()) {
if (channel.eventLoop().inEventLoop()) {
knownDisconnect = true;
channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE);
} else {
channel.eventLoop().execute(() -> {
knownDisconnect = true;
channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE);
});
}
}
}
/**
* Immediately closes the connection.
*/
public void close() {
if (channel.isActive()) {
if (channel.eventLoop().inEventLoop()) {
knownDisconnect = true;
channel.close();
} else {
channel.eventLoop().execute(() -> {
knownDisconnect = true;
channel.close();
});
}
}
}