geforkt von Mirrors/Velocity
Fix disconnect issues in 1.7-specific logic.
Dieser Commit ist enthalten in:
Ursprung
8a16db3794
Commit
9a0affbca9
@ -223,13 +223,10 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
|
|||||||
*/
|
*/
|
||||||
public void closeWith(Object msg) {
|
public void closeWith(Object msg) {
|
||||||
if (channel.isActive()) {
|
if (channel.isActive()) {
|
||||||
boolean is1Point8 = this.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0;
|
boolean is1_7 = this.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) < 0
|
||||||
boolean isLegacyOrPing = this.getState() == StateRegistry.HANDSHAKE
|
&& this.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_7_2) >= 0;
|
||||||
|| this.getState() == StateRegistry.STATUS;
|
if (is1_7) {
|
||||||
if (channel.eventLoop().inEventLoop() && (is1Point8 || isLegacyOrPing)) {
|
channel.eventLoop().execute(() -> {
|
||||||
knownDisconnect = true;
|
|
||||||
channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE);
|
|
||||||
} else {
|
|
||||||
// 1.7.x versions have a race condition with switching protocol states, 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.
|
// close the connection after a short while.
|
||||||
this.setAutoReading(false);
|
this.setAutoReading(false);
|
||||||
@ -237,6 +234,10 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
|
|||||||
knownDisconnect = true;
|
knownDisconnect = true;
|
||||||
channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE);
|
channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE);
|
||||||
}, 250, TimeUnit.MILLISECONDS);
|
}, 250, TimeUnit.MILLISECONDS);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
knownDisconnect = true;
|
||||||
|
channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
|||||||
onlineMode);
|
onlineMode);
|
||||||
final GameProfile finalProfile = profile;
|
final GameProfile finalProfile = profile;
|
||||||
|
|
||||||
server.getEventManager().fire(profileRequestEvent).thenCompose(profileEvent -> {
|
server.getEventManager().fire(profileRequestEvent).thenComposeAsync(profileEvent -> {
|
||||||
if (mcConnection.isClosed()) {
|
if (mcConnection.isClosed()) {
|
||||||
// The player disconnected after we authenticated them.
|
// The player disconnected after we authenticated them.
|
||||||
return CompletableFuture.completedFuture(null);
|
return CompletableFuture.completedFuture(null);
|
||||||
@ -234,7 +234,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
|||||||
completeLoginProtocolPhaseAndInitialize(player);
|
completeLoginProtocolPhaseAndInitialize(player);
|
||||||
}
|
}
|
||||||
}, mcConnection.eventLoop());
|
}, mcConnection.eventLoop());
|
||||||
}).exceptionally((ex) -> {
|
}, mcConnection.eventLoop()).exceptionally((ex) -> {
|
||||||
logger.error("Exception during connection of {}", finalProfile, ex);
|
logger.error("Exception during connection of {}", finalProfile, ex);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren