Skip to content

Commit

Permalink
update 1.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
AkmalFairuz committed Jul 9, 2024
1 parent 3dacfc1 commit 1e5ab9d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private void writeData(InetSocketAddress address, boolean simple, ByteBuf buf, I
"",
this.proxy.getPlayerManager().getPlayers().values(),
config.getMaxPlayerCount(),
"WaterdogPE",
"Venity Proxy", // TODO: VN CHANGE THIS
address
);
this.proxy.getEventManager().callEvent(event);
Expand All @@ -173,7 +173,8 @@ private void writeData(InetSocketAddress address, boolean simple, ByteBuf buf, I
map.put("hostport", Integer.toString(bindAddress.getPort()));
map.put("hostip", bindAddress.getHostName());
map.put("game_id", GAME_ID);
map.put("version", event.getVersion());
//map.put("version", event.getVersion());
map.put("version", "1.21.2"); // TODO: VN CHANGE THIS
map.put("plugins", ""); // Do not list plugins
map.put("whitelist", event.hasWhitelist() ? "on" : "off");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import org.cloudburstmc.protocol.bedrock.codec.v649.Bedrock_v649;
import org.cloudburstmc.protocol.bedrock.codec.v662.Bedrock_v662;
import org.cloudburstmc.protocol.bedrock.codec.v671.Bedrock_v671;
import org.cloudburstmc.protocol.bedrock.codec.v685.Bedrock_v685;

@ToString(exclude = {"defaultCodec", "bedrockCodec"})
public enum ProtocolVersion {
Expand Down Expand Up @@ -103,7 +104,8 @@ public enum ProtocolVersion {
MINECRAFT_PE_1_20_50(630, Bedrock_v630.CODEC),
MINECRAFT_PE_1_20_60(649, Bedrock_v649.CODEC),
MINECRAFT_PE_1_20_70(662, Bedrock_v662.CODEC),
MINECRAFT_PE_1_20_80(671, Bedrock_v671.CODEC);
MINECRAFT_PE_1_20_80(671, Bedrock_v671.CODEC),
MINECRAFT_PE_1_21_0(685, Bedrock_v685.CODEC);

private static final ProtocolVersion[] VALUES = values();
private static final Int2ObjectMap<ProtocolVersion> VERSIONS = new Int2ObjectOpenHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private ProtocolVersion checkVersion(int protocolVersion) {
@Override
public PacketSignal handle(RequestNetworkSettingsPacket packet) {
ProtocolVersion protocol;
if (!this.attemptLogin() || (protocol = this.checkVersion(packet.getProtocolVersion())) == null) {
if (!this.attemptLogin() || (protocol = this.checkVersion(convertProtocol(packet.getProtocolVersion()))) == null) {
return PacketSignal.HANDLED;
}

Expand All @@ -121,10 +121,19 @@ public PacketSignal handle(RequestNetworkSettingsPacket packet) {
return PacketSignal.HANDLED;
}

private int convertProtocol(int protocolVer){
if(protocolVer == 686){
// no protocol changes for 686, so use 685 instead
protocolVer = 685;
}
return protocolVer;
}

@Override
public PacketSignal handle(LoginPacket packet) {
ProtocolVersion protocol;
if (!this.attemptLogin() || (protocol = this.checkVersion(packet.getProtocolVersion())) == null) {

if (!this.attemptLogin() || (protocol = this.checkVersion(convertProtocol(packet.getProtocolVersion()))) == null) {
return PacketSignal.HANDLED;
}

Expand Down

0 comments on commit 1e5ab9d

Please sign in to comment.