diff options
author | Jake Potrebic <[email protected]> | 2023-06-12 16:51:45 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2023-06-12 16:51:45 -0700 |
commit | c287e921a96438964f32f3c4e394d6809e0d06fa (patch) | |
tree | fcc826670454d8a8f5547838414583ce5f1df02d /patches/server/0817-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch | |
parent | b48e2e352e21c56d6a9e90bb8d9e548d3658a691 (diff) | |
download | Paper-c287e921a96438964f32f3c4e394d6809e0d06fa.tar.gz Paper-c287e921a96438964f32f3c4e394d6809e0d06fa.zip |
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9301)1.20
Diffstat (limited to 'patches/server/0817-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch')
-rw-r--r-- | patches/server/0817-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/patches/server/0817-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch b/patches/server/0817-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch new file mode 100644 index 0000000000..46b984988b --- /dev/null +++ b/patches/server/0817-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: HexedHero <[email protected]> +Date: Sun, 10 Apr 2022 06:26:32 +0100 +Subject: [PATCH] Add pre-unbreaking amount to PlayerItemDamageEvent + + +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index 6b9924652ef3cb3b26042155b05df3458b2a25ab..ac688d6175cc4c82cb454100b19738318503701a 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -607,10 +607,11 @@ public final class ItemStack { + } + } + ++ int originalDamage = amount; // Paper + amount -= k; + // CraftBukkit start + if (player instanceof ServerPlayer serverPlayer) { // Paper +- PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount); // Paper ++ PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount, originalDamage); // Paper + event.getPlayer().getServer().getPluginManager().callEvent(event); + + if (amount != event.getDamage() || event.isCancelled()) { |