PaperMC/paper-server/nms-patches/net/minecraft/world/level/block/BlockSign.patch
CraftBukkit/Spigot 6d8757cb05 SPIGOT-7396: Add PlayerSignOpenEvent
By: Miles Holder <mwholder2005@gmail.com>
2023-08-05 09:33:42 +10:00

27 lines
1.5 KiB
Diff

--- a/net/minecraft/world/level/block/BlockSign.java
+++ b/net/minecraft/world/level/block/BlockSign.java
@@ -115,7 +115,7 @@
} else if (flag2) {
return EnumInteractionResult.SUCCESS;
} else if (!this.otherPlayerIsEditingSign(entityhuman, tileentitysign) && entityhuman.mayBuild() && this.hasEditableText(entityhuman, tileentitysign, flag1)) {
- this.openTextEdit(entityhuman, tileentitysign, flag1);
+ this.openTextEdit(entityhuman, tileentitysign, flag1, org.bukkit.event.player.PlayerSignOpenEvent.Cause.INTERACT); // CraftBukkit
return EnumInteractionResult.SUCCESS;
} else {
return EnumInteractionResult.PASS;
@@ -164,6 +164,15 @@
}
public void openTextEdit(EntityHuman entityhuman, TileEntitySign tileentitysign, boolean flag) {
+ // Craftbukkit start
+ openTextEdit(entityhuman, tileentitysign, flag, org.bukkit.event.player.PlayerSignOpenEvent.Cause.UNKNOWN);
+ }
+
+ public void openTextEdit(EntityHuman entityhuman, TileEntitySign tileentitysign, boolean flag, org.bukkit.event.player.PlayerSignOpenEvent.Cause cause) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerSignOpenEvent(entityhuman, tileentitysign, flag, cause)) {
+ return;
+ }
+ // Craftbukkit end
tileentitysign.setAllowedPlayerEditor(entityhuman.getUUID());
entityhuman.openTextEdit(tileentitysign, flag);
}