From 576682ef9f041a0b8db32623d88f5dbf3fe41853 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Sat, 15 May 2021 16:42:38 +0200 Subject: [PATCH] Handle invalid uuid int array Closes #2475 --- .../viaversion/bukkit/platform/BukkitViaInjector.java | 2 +- .../protocol1_16to1_15_2/packets/InventoryPackets.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaInjector.java b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaInjector.java index 59f5788de..ae2307f08 100644 --- a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaInjector.java +++ b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaInjector.java @@ -199,7 +199,7 @@ public class BukkitViaInjector implements ViaInjector { @Override public int getServerProtocolVersion() throws Exception { if (PaperViaInjector.PAPER_PROTOCOL_METHOD) { - // *Trust me, it's safe* + //noinspection deprecation return Bukkit.getUnsafe().getProtocolVersion(); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/InventoryPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/InventoryPackets.java index 7d458649c..9eb23254c 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/InventoryPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/InventoryPackets.java @@ -209,7 +209,7 @@ public class InventoryPackets { rewriteAttributeName(attribute, "AttributeName", true); rewriteAttributeName(attribute, "Name", true); IntArrayTag uuidTag = attribute.get("UUID"); - if (uuidTag != null) { + if (uuidTag != null && uuidTag.getValue().length == 4) { UUID uuid = UUIDIntArrayType.uuidFromIntArray(uuidTag.getValue()); attribute.put("UUIDLeast", new LongTag(uuid.getLeastSignificantBits())); attribute.put("UUIDMost", new LongTag(uuid.getMostSignificantBits()));