From d4077ddc1ad2b89d8ef5269749c74c2baef2ff00 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Tue, 2 Apr 2024 13:53:22 +0100 Subject: [PATCH] only send extended resource pack states on supported versions --- .../backend/BackendPlaySessionHandler.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java index 051a7cbcf..44a3839bc 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java @@ -28,6 +28,7 @@ import com.velocitypowered.api.event.connection.PluginMessageEvent; import com.velocitypowered.api.event.player.PlayerResourcePackStatusEvent; import com.velocitypowered.api.event.player.ServerResourcePackSendEvent; import com.velocitypowered.api.event.proxy.ProxyPingEvent; +import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.player.ResourcePackInfo; import com.velocitypowered.proxy.VelocityServer; @@ -209,10 +210,14 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler { if (serverConn.getConnection() != null) { serverConn.getConnection().write(new ResourcePackResponsePacket( packet.getId(), packet.getHash(), PlayerResourcePackStatusEvent.Status.ACCEPTED)); - serverConn.getConnection().write(new ResourcePackResponsePacket( - packet.getId(), packet.getHash(), PlayerResourcePackStatusEvent.Status.DOWNLOADED)); - serverConn.getConnection().write(new ResourcePackResponsePacket( - packet.getId(), packet.getHash(), PlayerResourcePackStatusEvent.Status.SUCCESSFUL)); + if (serverConn.getConnection().getProtocolVersion().noLessThan(ProtocolVersion.MINECRAFT_1_20_3)) { + serverConn.getConnection().write(new ResourcePackResponsePacket( + packet.getId(), packet.getHash(), + PlayerResourcePackStatusEvent.Status.DOWNLOADED)); + serverConn.getConnection().write(new ResourcePackResponsePacket( + packet.getId(), packet.getHash(), + PlayerResourcePackStatusEvent.Status.SUCCESSFUL)); + } } if (modifiedPack) { logger.warn("A plugin has tried to modify a ResourcePack provided by the backend server "