2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
Date: Thu, 24 Dec 2020 12:27:41 -0800
|
|
|
|
Subject: [PATCH] Added PlayerBedFailEnterEvent
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
2023-12-06 04:34:04 +01:00
|
|
|
index 77438ea56b83f6aecd5f9acb9c55d4cd6e86ff95..0e63fa3b49b1a275254cf108a51ab18e816aad49 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
2023-12-06 04:34:04 +01:00
|
|
|
@@ -119,14 +119,23 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
2021-06-11 14:02:28 +02:00
|
|
|
BlockPos finalblockposition = pos;
|
|
|
|
// CraftBukkit end
|
|
|
|
player.startSleepInBed(pos).ifLeft((entityhuman_enumbedresult) -> {
|
|
|
|
+ // Paper start - PlayerBedFailEnterEvent
|
|
|
|
+ if (entityhuman_enumbedresult != null) {
|
2021-08-27 11:51:18 +02:00
|
|
|
+ io.papermc.paper.event.player.PlayerBedFailEnterEvent event = new io.papermc.paper.event.player.PlayerBedFailEnterEvent((org.bukkit.entity.Player) player.getBukkitEntity(), io.papermc.paper.event.player.PlayerBedFailEnterEvent.FailReason.VALUES[entityhuman_enumbedresult.ordinal()], org.bukkit.craftbukkit.block.CraftBlock.at(world, finalblockposition), !world.dimensionType().bedWorks(), io.papermc.paper.adventure.PaperAdventure.asAdventure(entityhuman_enumbedresult.getMessage()));
|
2021-06-11 14:02:28 +02:00
|
|
|
+ if (!event.callEvent()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
// CraftBukkit start - handling bed explosion from below here
|
2021-08-27 11:51:18 +02:00
|
|
|
- if (!world.dimensionType().bedWorks()) {
|
2021-06-11 14:02:28 +02:00
|
|
|
+ if (event.getWillExplode()) { // Paper
|
|
|
|
this.explodeBed(finaliblockdata, world, finalblockposition);
|
|
|
|
} else
|
|
|
|
// CraftBukkit end
|
2022-06-08 10:00:56 +02:00
|
|
|
if (entityhuman_enumbedresult.getMessage() != null) {
|
2021-06-11 14:02:28 +02:00
|
|
|
- player.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
|
|
|
|
+ final net.kyori.adventure.text.Component message = event.getMessage(); // Paper
|
2022-06-08 10:00:56 +02:00
|
|
|
+ if (message != null) player.displayClientMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), true); // Paper
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
+ } // Paper
|
|
|
|
|
|
|
|
});
|
|
|
|
return InteractionResult.SUCCESS;
|