Fix error on 1.12

This commit is contained in:
libraryaddict 2020-05-22 20:38:06 +12:00
parent c60d676244
commit 57a4507de9
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
2 changed files with 10 additions and 3 deletions

View File

@ -5,7 +5,7 @@
<!-- A good example on why temporary names for project identification shouldn't be used -->
<groupId>LibsDisguises</groupId>
<artifactId>LibsDisguises</artifactId>
<version>10.0.9</version>
<version>10.0.9-SNAPSHOT</version>
<build>
<defaultGoal>exec:java clean install</defaultGoal>

View File

@ -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() {