Skip to content

Commit

Permalink
misc: Delete ClientVersionUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
MemencioPerez committed Nov 7, 2024
1 parent a2364b9 commit d34d233
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import com.github.retrooper.packetevents.event.PacketListenerPriority;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.manager.server.VersionComparison;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.protocol.player.User;
import com.github.retrooper.packetevents.util.crypto.MinecraftEncryptionUtil;
import com.github.retrooper.packetevents.wrapper.login.client.WrapperLoginClientEncryptionResponse;
Expand All @@ -17,7 +19,6 @@
import com.velocitypowered.api.proxy.config.ProxyConfig;
import io.github._4drian3d.unsignedvelocity.configuration.Configuration;
import io.github._4drian3d.unsignedvelocity.listener.packet.ConfigurablePacketListener;
import io.github._4drian3d.unsignedvelocity.utils.ClientVersionUtil;

import java.security.PublicKey;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -55,7 +56,7 @@ public void onPacketReceive(PacketReceiveEvent event) {
final User user = event.getUser();
final PacketTypeCommon packetType = event.getPacketType();
if (packetType == PacketType.Login.Client.LOGIN_START) {
if (ClientVersionUtil.doesNotEnforceKeyAuthentication(user)) {
if (!user.getClientVersion().is(VersionComparison.EQUALS, ClientVersion.V_1_19) && !user.getClientVersion().is(VersionComparison.EQUALS, ClientVersion.V_1_19_1)) {
return;
}

Expand All @@ -67,7 +68,7 @@ public void onPacketReceive(PacketReceiveEvent event) {
packet.setSignatureData(null);
event.markForReEncode(true);
} else if (packetType == PacketType.Login.Client.ENCRYPTION_RESPONSE) {
if (ClientVersionUtil.doesNotEnforceKeyAuthentication(user)) {
if (!user.getClientVersion().is(VersionComparison.EQUALS, ClientVersion.V_1_19) && !user.getClientVersion().is(VersionComparison.EQUALS, ClientVersion.V_1_19_1)) {
return;
}

Expand All @@ -91,7 +92,7 @@ public void onPacketSend(PacketSendEvent event) {
final User user = event.getUser();
final PacketTypeCommon packetType = event.getPacketType();
if (packetType == PacketType.Login.Server.ENCRYPTION_REQUEST) {
if (ClientVersionUtil.doesNotEnforceKeyAuthentication(user)) {
if (!user.getClientVersion().is(VersionComparison.EQUALS, ClientVersion.V_1_19) && !user.getClientVersion().is(VersionComparison.EQUALS, ClientVersion.V_1_19_1)) {
return;
}
WrapperLoginServerEncryptionRequest packet = new WrapperLoginServerEncryptionRequest(event);
Expand Down

This file was deleted.

0 comments on commit d34d233

Please sign in to comment.