diff options
Diffstat (limited to 'patches/server/0134-PlayerAttemptPickupItemEvent.patch')
-rw-r--r-- | patches/server/0134-PlayerAttemptPickupItemEvent.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/patches/server/0134-PlayerAttemptPickupItemEvent.patch b/patches/server/0134-PlayerAttemptPickupItemEvent.patch new file mode 100644 index 0000000000..50726dbd17 --- /dev/null +++ b/patches/server/0134-PlayerAttemptPickupItemEvent.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath <[email protected]> +Date: Sun, 11 Jun 2017 16:30:30 -0500 +Subject: [PATCH] PlayerAttemptPickupItemEvent + + +diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +index f51f04758e135294bab5c7d1f891a8d67fea78f5..f9dfd6e7b610cfee75524a525ab0e72bed5522da 100644 +--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java ++++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +@@ -40,6 +40,7 @@ import org.bukkit.event.entity.EntityPickupItemEvent; + import org.bukkit.event.entity.EntityRemoveEvent; + import org.bukkit.event.player.PlayerPickupItemEvent; + // CraftBukkit end ++import org.bukkit.event.player.PlayerAttemptPickupItemEvent; // Paper + + public class ItemEntity extends Entity implements TraceableEntity { + +@@ -438,6 +439,22 @@ public class ItemEntity extends Entity implements TraceableEntity { + int remaining = i - canHold; + boolean flyAtPlayer = false; // Paper + ++ // Paper start - PlayerAttemptPickupItemEvent ++ if (this.pickupDelay <= 0) { ++ PlayerAttemptPickupItemEvent attemptEvent = new PlayerAttemptPickupItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); ++ this.level().getCraftServer().getPluginManager().callEvent(attemptEvent); ++ ++ flyAtPlayer = attemptEvent.getFlyAtPlayer(); ++ if (attemptEvent.isCancelled()) { ++ if (flyAtPlayer) { ++ player.take(this, i); ++ } ++ ++ return; ++ } ++ } ++ // Paper end - PlayerAttemptPickupItemEvent ++ + if (this.pickupDelay <= 0 && canHold > 0) { + itemstack.setCount(canHold); + // Call legacy event |