From 676185481e4521cb5d7d00729625e77aa2e6fe2b Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 25 Jun 2021 18:41:02 +1200 Subject: [PATCH] Edit scoreboard teams so it works for 1.17, fixes #578 --- pom.xml | 8 ++------ .../packetlisteners/PacketListenerScoreboardTeam.java | 10 +++++++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 59868aef..6dc29e7e 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ 9.0 1.18.16 - 4.6.0 + 4.7.0-SNAPSHOT [1.17,] 4.13.1 [1.16,] @@ -121,7 +121,7 @@ true - com.github.dmulloy2 + com.comphenix.protocol ProtocolLib ${protocollib.version} true @@ -183,10 +183,6 @@ - - jitpack.io - https://jitpack.io - md_5-releases https://repo.md-5.net/content/groups/public/ diff --git a/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerScoreboardTeam.java b/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerScoreboardTeam.java index 7417254d..9dc1d1b1 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerScoreboardTeam.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerScoreboardTeam.java @@ -8,6 +8,7 @@ import com.comphenix.protocol.reflect.StructureModifier; import com.comphenix.protocol.wrappers.WrappedChatComponent; import me.libraryaddict.disguise.LibsDisguises; import me.libraryaddict.disguise.utilities.DisguiseUtilities; +import me.libraryaddict.disguise.utilities.reflection.NmsVersion; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.chat.ComponentSerializer; @@ -34,7 +35,14 @@ public class PacketListenerScoreboardTeam extends PacketAdapter { return; } - StructureModifier chats = packet.getChatComponents(); + StructureModifier chats; + + if (NmsVersion.v1_17.isSupported()) { + // Might need to do sanity checks but eh + chats = packet.getOptionalStructures().read(0).get().getChatComponents(); + } else { + chats = packet.getChatComponents(); + } BaseComponent[] prefix = DisguiseUtilities.getColoredChat(team.getPrefix()); BaseComponent[] suffix = DisguiseUtilities.getColoredChat(team.getSuffix());