geforkt von Mirrors/Velocity
Minor server-switching code cleanup
Dieser Commit ist enthalten in:
Ursprung
ea577019b8
Commit
31aa996623
@ -358,24 +358,27 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
final MinecraftConnection serverMc = destination.ensureConnected();
|
final MinecraftConnection serverMc = destination.ensureConnected();
|
||||||
|
|
||||||
if (!spawned) {
|
if (!spawned) {
|
||||||
// Nothing special to do with regards to spawning the player
|
// The player wasn't spawned in yet, so we don't need to do anything special. Just send
|
||||||
|
// JoinGame.
|
||||||
spawned = true;
|
spawned = true;
|
||||||
|
|
||||||
destination.setActiveDimensionRegistry(joinGame.getDimensionRegistry()); // 1.16
|
|
||||||
player.getConnection().delayedWrite(joinGame);
|
player.getConnection().delayedWrite(joinGame);
|
||||||
// Required for Legacy Forge
|
// Required for Legacy Forge
|
||||||
player.getPhase().onFirstJoin(player);
|
player.getPhase().onFirstJoin(player);
|
||||||
} else {
|
} else {
|
||||||
// Clear tab list to avoid duplicate entries
|
// Clear tab list to avoid duplicate entries
|
||||||
player.getTabList().clearAll();
|
player.getTabList().clearAll();
|
||||||
|
|
||||||
|
// The player is switching from a server already, so we need to tell the client to change
|
||||||
|
// entity IDs and send new dimension information.
|
||||||
if (player.getConnection().getType() == ConnectionTypes.LEGACY_FORGE) {
|
if (player.getConnection().getType() == ConnectionTypes.LEGACY_FORGE) {
|
||||||
this.doSafeClientServerSwitch(joinGame);
|
this.doSafeClientServerSwitch(joinGame);
|
||||||
} else {
|
} else {
|
||||||
this.doFastClientServerSwitch(joinGame);
|
this.doFastClientServerSwitch(joinGame);
|
||||||
}
|
}
|
||||||
destination.setActiveDimensionRegistry(joinGame.getDimensionRegistry()); // 1.16
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destination.setActiveDimensionRegistry(joinGame.getDimensionRegistry()); // 1.16
|
||||||
|
|
||||||
// Remove previous boss bars. These don't get cleared when sending JoinGame, thus the need to
|
// Remove previous boss bars. These don't get cleared when sending JoinGame, thus the need to
|
||||||
// track them.
|
// track them.
|
||||||
for (UUID serverBossBar : serverBossBars) {
|
for (UUID serverBossBar : serverBossBars) {
|
||||||
@ -400,8 +403,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
|
|
||||||
// Clear any title from the previous server.
|
// Clear any title from the previous server.
|
||||||
if (player.getProtocolVersion().compareTo(MINECRAFT_1_8) >= 0) {
|
if (player.getProtocolVersion().compareTo(MINECRAFT_1_8) >= 0) {
|
||||||
player.getConnection()
|
player.getConnection().delayedWrite(GenericTitlePacket.constructTitlePacket(
|
||||||
.delayedWrite(GenericTitlePacket.constructTitlePacket(
|
|
||||||
GenericTitlePacket.ActionType.RESET, player.getProtocolVersion()));
|
GenericTitlePacket.ActionType.RESET, player.getProtocolVersion()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren