Skip to content

Commit

Permalink
More bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Redned235 committed Sep 24, 2023
1 parent 3e9fb04 commit b014087
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public boolean handle(JoinGame packet) {

// Change the client to use the ClientPlaySessionHandler if required.
ClientPlaySessionHandler playHandler;
if (player.getConnection().setActiveSessionHandler(StateRegistry.PLAY)) {
if (player.getConnection().getActiveSessionHandler() instanceof ClientPlaySessionHandler) {
playHandler = (ClientPlaySessionHandler) player.getConnection().getActiveSessionHandler();
} else {
playHandler = new ClientPlaySessionHandler(server, player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private void completeLoginProtocolPhaseAndInitialize(ConnectedPlayer player) {
return;
}

if (inbound.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) > 0) {
if (inbound.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) < 0) {
mcConnection.setActiveSessionHandler(StateRegistry.PLAY, new InitialConnectSessionHandler(player, server));
} else {
mcConnection.setActiveSessionHandler(StateRegistry.CONFIG, new ClientConfigSessionHandler(server, player));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionCommandHandler;
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerChat;
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerCommand;
import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdate;
import com.velocitypowered.proxy.protocol.packet.config.StartUpdate;
import com.velocitypowered.proxy.protocol.packet.title.GenericTitlePacket;
import com.velocitypowered.proxy.protocol.util.PluginMessageUtil;
Expand Down Expand Up @@ -384,7 +385,7 @@ public boolean handle(ResourcePackResponse packet) {
}

@Override
public boolean handle(StartUpdate packet) {
public boolean handle(FinishedUpdate packet) {
//Complete client switch
player.getConnection().setActiveSessionHandler(StateRegistry.CONFIG);
configSwitchFuture.complete(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public enum StateRegistry {
map(0x23, ProtocolVersion.MINECRAFT_1_19, false),
map(0x24, ProtocolVersion.MINECRAFT_1_19_1, false),
map(0x27, ProtocolVersion.MINECRAFT_1_20_2, false));
serverbound.register(StartUpdate.class, StartUpdate::new,
serverbound.register(FinishedUpdate.class, FinishedUpdate::new,
map(0x0B, ProtocolVersion.MINECRAFT_1_20_2, false));

clientbound.register(BossBar.class, BossBar::new,
Expand Down

0 comments on commit b014087

Please sign in to comment.