blob: 16155347a99078ee4153ecca188fa42e518addeb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: by77er <by77er@gmail.com>
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);
}
|