testserver/Spigot-Server-Patches/0215-PlayerAttemptPickupIte...

35 lines
1.5 KiB
Diff
Raw Normal View History

2017-07-28 13:45:16 +00:00
From acb8885cb0b64c6a23c1a280e3c3273f59f94410 Mon Sep 17 00:00:00 2001
2017-06-12 00:46:11 +00:00
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 11 Jun 2017 16:30:30 -0500
Subject: [PATCH] PlayerAttemptPickupItemEvent
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
2017-07-28 13:45:16 +00:00
index fed1f4ab2..a580a5866 100644
2017-06-12 00:46:11 +00:00
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
2017-07-28 13:45:16 +00:00
@@ -8,6 +8,7 @@ import org.apache.logging.log4j.Logger;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
// CraftBukkit end
+import org.bukkit.event.player.PlayerAttemptPickupItemEvent; // Paper
2017-06-12 00:46:11 +00:00
import com.destroystokyo.paper.HopperPusher; // Paper
2017-07-28 13:45:16 +00:00
// Paper start - implement HopperPusher
@@ -329,6 +330,12 @@ public class EntityItem extends Entity implements HopperPusher {
2017-06-12 00:46:11 +00:00
Item item = itemstack.getItem();
int i = itemstack.getCount();
+ // Paper start
+ if (this.pickupDelay <= 0) {
+ this.world.getServer().getPluginManager().callEvent(new PlayerAttemptPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity()));
+ }
+ // Paper end
+
// CraftBukkit start - fire PlayerPickupItemEvent
int canHold = entityhuman.inventory.canHold(itemstack);
int remaining = i - canHold;
--
2017-07-28 13:45:16 +00:00
2.13.3
2017-06-12 00:46:11 +00:00