From ab4b9277e439462bbc498834c9b45699dfb4a7e9 Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Mon, 30 Oct 2023 20:27:44 +0100 Subject: [PATCH] Hotfix for NPE in spectator emulation Fixed https://github.com/ViaVersion/ViaRewind/issues/462 --- .../protocol1_7_6_10to1_8/packets/PlayerPackets.java | 2 +- .../protocol1_7_6_10to1_8/storage/GameProfileStorage.java | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/packets/PlayerPackets.java b/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/packets/PlayerPackets.java index aa5f5e6bc..616146607 100644 --- a/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/packets/PlayerPackets.java +++ b/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/packets/PlayerPackets.java @@ -210,7 +210,7 @@ public void register() { Item[] equipment = new Item[4]; if (gameMode == 3) { GameProfileStorage.GameProfile profile = wrapper.user().get(GameProfileStorage.class).get(myId); - equipment[3] = profile.getSkull(); + equipment[3] = profile == null ? null : profile.getSkull(); } else { for (int i = 0; i < equipment.length; i++) { equipment[i] = playerSession.getPlayerEquipment(myId, i); diff --git a/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/storage/GameProfileStorage.java b/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/storage/GameProfileStorage.java index 88a9e41e8..7d0803eca 100644 --- a/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/storage/GameProfileStorage.java +++ b/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/storage/GameProfileStorage.java @@ -43,14 +43,6 @@ public GameProfile put(UUID uuid, String name) { return gameProfile; } - public void putProperty(UUID uuid, Property property) { - properties.computeIfAbsent(uuid, profile -> new GameProfile(uuid, null)).properties.add(property); - } - - public void putProperty(UUID uuid, String name, String value, String signature) { - putProperty(uuid, new Property(name, value, signature)); - } - public GameProfile get(UUID uuid) { return properties.get(uuid); }