geforkt von Mirrors/Velocity
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:
Commit
f9a98ae41c
@ -82,6 +82,12 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
|||||||
if (existingConnection == null) {
|
if (existingConnection == null) {
|
||||||
// Strap on the play session handler
|
// Strap on the play session handler
|
||||||
connection.getPlayer().getConnection().setSessionHandler(new ClientPlaySessionHandler(server, connection.getPlayer()));
|
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 {
|
} else {
|
||||||
// The previous server connection should become obsolete.
|
// 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.
|
// Before we remove it, if the server we are departing is modded, we must always reset the client state.
|
||||||
|
@ -214,7 +214,20 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
player.getConnection().flush();
|
player.getConnection().flush();
|
||||||
player.getConnectedServer().getMinecraftConnection().flush();
|
player.getConnectedServer().getMinecraftConnection().flush();
|
||||||
player.getConnectedServer().setHasCompletedJoin(true);
|
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() {
|
public List<UUID> getServerBossBars() {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren