Avoid NPE due to PlayerBedFailEnterEvent

fixes #5670
Dieser Commit ist enthalten in:
Riley Park 2021-05-18 08:57:17 -07:00
Ursprung d3c9a195cb
Commit 322886c869
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: D831AF236C834E45

Datei anzeigen

@ -17,7 +17,7 @@ index 3a13e7a050db7f5c93d810afe56325495cec7aa4..c39c50e53549e9cb9d3520bc7e8b7e89
public IChatBaseComponent a() { public IChatBaseComponent a() {
return this.g; 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 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 --- a/src/main/java/net/minecraft/world/level/block/BlockBed.java
+++ b/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; @@ -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 { 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; BlockPosition finalblockposition = blockposition;
// CraftBukkit end // CraftBukkit end
entityhuman.sleep(blockposition).ifLeft((entityhuman_enumbedresult) -> { entityhuman.sleep(blockposition).ifLeft((entityhuman_enumbedresult) -> {
@ -48,7 +48,8 @@ index eca84595342756e3550883551e487aaf79574fde..abe0a1c309d526de37efcac44922fa25
// CraftBukkit end // CraftBukkit end
if (entityhuman_enumbedresult != null) { if (entityhuman_enumbedresult != null) {
- entityhuman.a(entityhuman_enumbedresult.a(), true); - 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 + } // Paper