Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.

Commit f6f643e

Browse files
Added >=1.20.5 versions support
1 parent b28053c commit f6f643e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/java/com/andcool/handlers/LoginStartHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ public static void handleLoginStart(ChannelHandlerContext ctx, ByteBuf in, Sessi
1717
String nickname = ByteBufUtils.readUTF8(in);
1818
OAuthServer.logger.log(Level.DEBUG, format("Login start for: %s (protocol version %s)", nickname, session.protocolVersion));
1919
session.nickname = nickname;
20-
EncryptionRequest.sendEncryptionRequest(ctx);
20+
EncryptionRequest.sendEncryptionRequest(ctx, session.protocolVersion);
2121
}
2222
}

src/main/java/com/andcool/pipeline/EncryptionRequest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import java.io.IOException;
1010

1111
public class EncryptionRequest {
12-
public static void sendEncryptionRequest(ChannelHandlerContext ctx) throws IOException {
12+
public static void sendEncryptionRequest(ChannelHandlerContext ctx, int protocolVersion) throws IOException {
1313
ByteBuf out = ctx.alloc().buffer();
1414
ByteBufUtils.writeVarInt(out, 0x01); // Packet ID
1515
ByteBufUtils.writeUTF8(out, UserConfig.SERVER_ID); // Server ID
@@ -21,6 +21,10 @@ public static void sendEncryptionRequest(ChannelHandlerContext ctx) throws IOExc
2121
ByteBufUtils.writeVarInt(out, OAuthServer.VERIFY_TOKEN.length);
2222
out.writeBytes(OAuthServer.VERIFY_TOKEN);
2323

24+
if (protocolVersion >= 766) {
25+
out.writeBoolean(true);
26+
}
27+
2428
ByteBufUtils.sendPacket(ctx, out);
2529
}
2630
}

0 commit comments

Comments
 (0)