From 9fd870db0b681b9840706aea4958376492e725b5 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Mon, 9 May 2022 17:22:57 -0700 Subject: [PATCH] Fix cancelling PlayerItemFrameChangeEvent (#7761) --- patches/server/0803-Add-PlayerItemFrameChangeEvent.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/server/0803-Add-PlayerItemFrameChangeEvent.patch b/patches/server/0803-Add-PlayerItemFrameChangeEvent.patch index 464f2144c..02aa6ad97 100644 --- a/patches/server/0803-Add-PlayerItemFrameChangeEvent.patch +++ b/patches/server/0803-Add-PlayerItemFrameChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerItemFrameChangeEvent diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java -index d02f507ac58bae5d4f669dae52cc01c35651cee5..f134a2e68d50fba021b19fac4c75fb35d0e252c6 100644 +index d02f507ac58bae5d4f669dae52cc01c35651cee5..a6d94e99d18cd569545981014af733ba8fdb4d31 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java @@ -2,6 +2,7 @@ package net.minecraft.world.entity.decoration; @@ -23,7 +23,7 @@ index d02f507ac58bae5d4f669dae52cc01c35651cee5..f134a2e68d50fba021b19fac4c75fb35 + // Paper start - call PlayerItemFrameChangeEvent + if (source.getEntity() instanceof Player player) { + var event = new PlayerItemFrameChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.ItemFrame) this.getBukkitEntity(), this.getItem().asBukkitCopy(), PlayerItemFrameChangeEvent.ItemFrameChangeAction.REMOVE); -+ if (!event.callEvent()) return false; ++ if (!event.callEvent()) return true; // return true here because you aren't cancelling the damage, just the change + this.setItem(ItemStack.fromBukkitCopy(event.getItemStack()), false); + } + // Paper end