3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-25 15:50:19 +01:00

Merge pull request #70 from dualspiral/bugfix/reset-packet

Ensure the reset packet is not sent when Forge isn't expecting it.
Dieser Commit ist enthalten in:
Andrew Steinborn 2018-09-10 15:00:18 -04:00 committet von GitHub
Commit f9a98ae41c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 20 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -82,6 +82,12 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
if (existingConnection == null) {
// Strap on the play session handler
connection.getPlayer().getConnection().setSessionHandler(new ClientPlaySessionHandler(server, connection.getPlayer()));
// This is for legacy Forge servers - during first connection the FML handshake will transition to complete regardless
// Thus, we need to ensure that a reset packet is ALWAYS sent on first switch.
//
// The call will handle if the player is not a Forge player appropriately.
connection.getPlayer().getConnection().setCanSendLegacyFMLResetPacket(true);
} else {
// The previous server connection should become obsolete.
// Before we remove it, if the server we are departing is modded, we must always reset the client state.

Datei anzeigen

@ -214,7 +214,20 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
player.getConnection().flush();
player.getConnectedServer().getMinecraftConnection().flush();
player.getConnectedServer().setHasCompletedJoin(true);
player.getConnection().setCanSendLegacyFMLResetPacket(true);
if (player.getConnectedServer().isLegacyForge()) {
// We only need to indicate we can send a reset packet if we complete a handshake, that is,
// logged onto a Forge server.
//
// The special case is if we log onto a Vanilla server as our first server, FML will treat this
// as complete and **will** need a reset packet sending at some point. We will handle this
// during initial player connection if the player is detected to be forge.
//
// This is why we use an if statement rather than the result of VelocityServerConnection#isLegacyForge()
// because we don't want to set it false if this is a first connection to a Vanilla server.
//
// See LoginSessionHandler#handle for where the counterpart to this method is
player.getConnection().setCanSendLegacyFMLResetPacket(true);
}
}
public List<UUID> getServerBossBars() {