diff --git a/core/build.gradle b/core/build.gradle index b1b6506c..dcad2da3 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -16,7 +16,7 @@ dependencies { compileOnly 'net.md-5:bungeecord-proxy:1.21-R0.1-SNAPSHOT' compileOnly 'com.velocitypowered:velocity-api:3.1.0' annotationProcessor 'com.velocitypowered:velocity-api:3.1.0' - compileOnly 'com.comphenix.protocol:ProtocolLib:5.3.0-SNAPSHOT' + compileOnly 'com.comphenix.protocol:ProtocolLib:5.4.0-SNAPSHOT' // Adventure / MiniMessage compileOnly 'net.kyori:adventure-text-serializer-gson:4.9.3' diff --git a/core/src/main/java/com/rexcantor64/triton/packetinterceptor/protocollib/EntitiesPacketHandler.java b/core/src/main/java/com/rexcantor64/triton/packetinterceptor/protocollib/EntitiesPacketHandler.java index aa64abdb..f10bd358 100644 --- a/core/src/main/java/com/rexcantor64/triton/packetinterceptor/protocollib/EntitiesPacketHandler.java +++ b/core/src/main/java/com/rexcantor64/triton/packetinterceptor/protocollib/EntitiesPacketHandler.java @@ -481,7 +481,43 @@ private void handlePlayerInfo(PacketEvent packet, SpigotLanguagePlayer languageP msg.setJson(ComponentSerializer.toString(result)); } } - dataListNew.add(new PlayerInfoData(data.getProfileId(), data.getLatency(), data.isListed(), data.getGameMode(), newGP, msg, data.getProfileKeyData())); + if (MinecraftVersion.FEATURE_PREVIEW_UPDATE.atOrAbove()) { // 1.19.3 + try { + dataListNew.add(new PlayerInfoData( + data.getProfileId(), + data.getLatency(), + data.isListed(), + data.getGameMode(), + newGP, + msg, + data.isShowHat(), + data.getListOrder(), + data.getRemoteChatSessionData() + )); + } catch (NoSuchMethodError ignore) { + // Fallback until https://github.com/dmulloy2/ProtocolLib/pull/3347 gets merged. + // Also allows for older servers to keep using ProtocolLib 5.3.0 + dataListNew.add(new PlayerInfoData( + data.getProfileId(), + data.getLatency(), + data.isListed(), + data.getGameMode(), + newGP, + msg, + data.getRemoteChatSessionData() + )); + } + } else { + dataListNew.add(new PlayerInfoData( + data.getProfileId(), + data.getLatency(), + data.isListed(), + data.getGameMode(), + newGP, + msg, + data.getProfileKeyData() + )); + } } if (MinecraftVersion.FEATURE_PREVIEW_UPDATE.atOrAbove()) { packet.getPacket().getPlayerInfoDataLists().writeSafely(1, dataListNew);