From bc7c41cfbcf5347817b1126bec1c0fa2cf934ce3 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 22 Mar 2023 14:21:06 -0400 Subject: [PATCH] SPIGOT-7308: Fix NullPointerException when calling Jukebox#setRecord() By: Parker Hawke --- .../level/block/entity/TileEntityJukeBox.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/paper-server/nms-patches/net/minecraft/world/level/block/entity/TileEntityJukeBox.patch b/paper-server/nms-patches/net/minecraft/world/level/block/entity/TileEntityJukeBox.patch index d626e46353..2a83db905f 100644 --- a/paper-server/nms-patches/net/minecraft/world/level/block/entity/TileEntityJukeBox.patch +++ b/paper-server/nms-patches/net/minecraft/world/level/block/entity/TileEntityJukeBox.patch @@ -66,3 +66,16 @@ } @Override +@@ -203,7 +246,11 @@ + @VisibleForTesting + public void setRecordWithoutPlaying(ItemStack itemstack) { + this.items.set(0, itemstack); +- this.level.updateNeighborsAt(this.getBlockPos(), this.getBlockState().getBlock()); ++ // CraftBukkit start - add null check for level ++ if (level != null) { ++ this.level.updateNeighborsAt(this.getBlockPos(), this.getBlockState().getBlock()); ++ } ++ // CraftBukkit end + this.setChanged(); + } + }