geforkt von Mirrors/Velocity
Small cleanup in closeWith
Dieser Commit ist enthalten in:
Ursprung
005c12fb0f
Commit
6b26daa281
@ -225,13 +225,13 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
|
||||
public void closeWith(Object msg) {
|
||||
if (channel.isActive()) {
|
||||
boolean is1Point8 = this.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0;
|
||||
boolean isLegacyPing = this.getState() == StateRegistry.HANDSHAKE
|
||||
boolean isLegacyOrPing = this.getState() == StateRegistry.HANDSHAKE
|
||||
|| this.getState() == StateRegistry.STATUS;
|
||||
if (channel.eventLoop().inEventLoop() && (is1Point8 || isLegacyPing)) {
|
||||
if (channel.eventLoop().inEventLoop() && (is1Point8 || isLegacyOrPing)) {
|
||||
knownDisconnect = true;
|
||||
channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE);
|
||||
} else {
|
||||
// 1.7.x versions have a race condition with switching protocol versions, so just explicitly
|
||||
// 1.7.x versions have a race condition with switching protocol states, so just explicitly
|
||||
// close the connection after a short while.
|
||||
this.setAutoReading(false);
|
||||
channel.eventLoop().schedule(() -> {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren