Skip to content

Commit

Permalink
fix(spigot): tab item listOrder not persisted
Browse files Browse the repository at this point in the history
Fixes #474
Requires [1] to be merged upstream

[1]: dmulloy2/ProtocolLib#3347
  • Loading branch information
diogotcorreia committed Jan 22, 2025
1 parent a33bc87 commit f8eeaf9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f8eeaf9

Please sign in to comment.