diff options
author | Jake Potrebic <[email protected]> | 2023-11-04 14:11:55 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2023-11-04 14:11:55 -0700 |
commit | 0cdce89d595a2c1c097c9e2a5ff96687977b3b25 (patch) | |
tree | de63d6aa8112811f93b5d6afebbb069b9980870f /patches/server/0797-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch | |
parent | 15a0de2eefb70ea8162cbb31056920adf80265fa (diff) | |
download | Paper-0cdce89d595a2c1c097c9e2a5ff96687977b3b25.tar.gz Paper-0cdce89d595a2c1c097c9e2a5ff96687977b3b25.zip |
Fix a bunch of stuff with player spawn locations (#9887)
If a playerdata doesn't contain a valid, loaded world, reset
to the main world spawn point
Diffstat (limited to 'patches/server/0797-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch')
-rw-r--r-- | patches/server/0797-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/patches/server/0797-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch b/patches/server/0797-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch new file mode 100644 index 0000000000..676f145bb4 --- /dev/null +++ b/patches/server/0797-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 e615c8b5c1142f547af77dafb33a8772ab5e13c3..f83c60f94d6eeec50aefa59a39f6230953fe5b7e 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -617,10 +617,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()) { |