From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: by77er Date: Mon, 12 Jun 2023 12:56:46 -0400 Subject: [PATCH] Add event for player editing sign diff --git a/src/main/java/net/minecraft/world/level/block/SignBlock.java b/src/main/java/net/minecraft/world/level/block/SignBlock.java index 5ab7df0042391cb621ed78a187dc20333e344186..f7fda6fb4e908869310c783e68f7ad7025840592 100644 --- a/src/main/java/net/minecraft/world/level/block/SignBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java @@ -144,6 +144,16 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo } public void openTextEdit(Player player, SignBlockEntity blockEntity, boolean front) { + // Paper start + org.bukkit.entity.Player bukkitPlayer = (org.bukkit.entity.Player) player.getBukkitEntity(); + org.bukkit.block.Block bukkitBlock = org.bukkit.craftbukkit.block.CraftBlock.at(blockEntity.getLevel(), blockEntity.getBlockPos()); + org.bukkit.craftbukkit.block.CraftSign bukkitSign = (org.bukkit.craftbukkit.block.CraftSign) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(bukkitBlock); + io.papermc.paper.event.player.PlayerOpenSignEvent event = new io.papermc.paper.event.player.PlayerOpenSignEvent( + bukkitPlayer, + bukkitSign, + front ? org.bukkit.block.sign.Side.FRONT : org.bukkit.block.sign.Side.BACK); + if (!event.callEvent()) return; + // Paper end blockEntity.setAllowedPlayerEditor(player.getUUID()); player.openTextEdit(blockEntity, front); }