mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 13:07:06 +01:00
2873869bb1
Signs no longer have a specific isEdiable state, the entire API in this regard needs updating/deprecation. The boolean field is completely gone, replaced by a uuid (which will need a new setEditingPlayer(UUID) method on the Sign interface), and the current upstream implementation of setEdiable simply flips the is_waxed state. This patch is hence not needed as it neither allows editing (which will be redone in a later patch) nor is required to copy the is_waxed boolean flag as it lives in the signs compound tag and is covered by applyTo.
36 lines
2.5 KiB
Diff
36 lines
2.5 KiB
Diff
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
|
|
index efac034d07f4aadf5dc4ca8322e0dc7d861e6034..a605c9739ebc8e60bd668ff67c760cca9bd210dc 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
|
@@ -109,14 +109,23 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
|
BlockPos finalblockposition = pos;
|
|
// CraftBukkit end
|
|
player.startSleepInBed(pos).ifLeft((entityhuman_enumbedresult) -> {
|
|
+ // Paper start - PlayerBedFailEnterEvent
|
|
+ if (entityhuman_enumbedresult != null) {
|
|
+ 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()));
|
|
+ if (!event.callEvent()) {
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
// CraftBukkit start - handling bed explosion from below here
|
|
- if (!world.dimensionType().bedWorks()) {
|
|
+ if (event.getWillExplode()) { // Paper
|
|
this.explodeBed(finaliblockdata, world, finalblockposition);
|
|
} else
|
|
// CraftBukkit end
|
|
if (entityhuman_enumbedresult.getMessage() != null) {
|
|
- player.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
|
|
+ final net.kyori.adventure.text.Component message = event.getMessage(); // Paper
|
|
+ if (message != null) player.displayClientMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), true); // Paper
|
|
}
|
|
+ } // Paper
|
|
|
|
});
|
|
return InteractionResult.SUCCESS;
|