From 57a4507de9fc24944bef6753a07e7c865c7de2ff Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 22 May 2020 20:38:06 +1200 Subject: [PATCH] Fix error on 1.12 --- pom.xml | 2 +- .../PacketListenerChannelRegister.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index c32fc5f0..2728a300 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ LibsDisguises LibsDisguises - 10.0.9 + 10.0.9-SNAPSHOT exec:java clean install diff --git a/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerChannelRegister.java b/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerChannelRegister.java index 506a624f..79002e2f 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerChannelRegister.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerChannelRegister.java @@ -6,6 +6,7 @@ import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketEvent; import me.libraryaddict.disguise.LibsDisguises; +import me.libraryaddict.disguise.utilities.reflection.NmsVersion; import org.bukkit.entity.Player; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.scheduler.BukkitRunnable; @@ -23,8 +24,14 @@ public class PacketListenerChannelRegister extends PacketAdapter { @Override public void onPacketReceiving(PacketEvent event) { - if (!event.getPacket().getMinecraftKeys().read(0).getFullKey().equals("minecraft:brand")) { - return; + if (NmsVersion.v1_13.isSupported()) { + if (!event.getPacket().getMinecraftKeys().read(0).getFullKey().equals("minecraft:brand")) { + return; + } + } else { + if (!event.getPacket().getStrings().read(0).equals("MC|Brand")) { + return; + } } new BukkitRunnable() {