From 322886c8693a7db4dc6e2b2d5bd8ce6a9f8c4b0f Mon Sep 17 00:00:00 2001 From: Riley Park Date: Tue, 18 May 2021 08:57:17 -0700 Subject: [PATCH] Avoid NPE due to PlayerBedFailEnterEvent fixes #5670 --- .../0715-Added-PlayerBedFailEnterEvent.patch | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Spigot-Server-Patches/0715-Added-PlayerBedFailEnterEvent.patch b/Spigot-Server-Patches/0715-Added-PlayerBedFailEnterEvent.patch index f74fd8eb88..16189aeee4 100644 --- a/Spigot-Server-Patches/0715-Added-PlayerBedFailEnterEvent.patch +++ b/Spigot-Server-Patches/0715-Added-PlayerBedFailEnterEvent.patch @@ -17,7 +17,7 @@ index 3a13e7a050db7f5c93d810afe56325495cec7aa4..c39c50e53549e9cb9d3520bc7e8b7e89 public IChatBaseComponent a() { return this.g; diff --git a/src/main/java/net/minecraft/world/level/block/BlockBed.java b/src/main/java/net/minecraft/world/level/block/BlockBed.java -index eca84595342756e3550883551e487aaf79574fde..abe0a1c309d526de37efcac44922fa259e1d112c 100644 +index eca84595342756e3550883551e487aaf79574fde..00a01a157deec004bcf2f8587723a0ecd0bfef85 100644 --- a/src/main/java/net/minecraft/world/level/block/BlockBed.java +++ b/src/main/java/net/minecraft/world/level/block/BlockBed.java @@ -43,6 +43,8 @@ import net.minecraft.world.phys.shapes.VoxelShape; @@ -29,7 +29,7 @@ index eca84595342756e3550883551e487aaf79574fde..abe0a1c309d526de37efcac44922fa25 public class BlockBed extends BlockFacingHorizontal implements ITileEntity { -@@ -101,14 +103,22 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { +@@ -101,14 +103,23 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { BlockPosition finalblockposition = blockposition; // CraftBukkit end entityhuman.sleep(blockposition).ifLeft((entityhuman_enumbedresult) -> { @@ -48,7 +48,8 @@ index eca84595342756e3550883551e487aaf79574fde..abe0a1c309d526de37efcac44922fa25 // CraftBukkit end if (entityhuman_enumbedresult != null) { - entityhuman.a(entityhuman_enumbedresult.a(), true); -+ entityhuman.a(PaperAdventure.asVanilla(event.getMessage()), true); // Paper ++ final net.kyori.adventure.text.Component message = event.getMessage(); // Paper ++ if(message != null) entityhuman.a(PaperAdventure.asVanilla(message), true); // Paper } + } // Paper