2017-06-12 03:02:57 +02:00
|
|
|
From 60df54b7313c848e4144b3023ee60ce26b980b25 Mon Sep 17 00:00:00 2001
|
2017-06-12 02:46:11 +02: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-06-12 03:02:57 +02:00
|
|
|
index 6ed3d7906..21a7a3a12 100644
|
2017-06-12 02:46:11 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
|
|
|
@@ -4,6 +4,7 @@ import java.util.Iterator;
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
+import org.bukkit.event.player.PlayerAttemptPickupItemEvent;
|
|
|
|
import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit
|
|
|
|
import com.destroystokyo.paper.HopperPusher; // Paper
|
|
|
|
|
2017-06-12 03:02:57 +02:00
|
|
|
@@ -326,6 +327,12 @@ public class EntityItem extends Entity implements HopperPusher {
|
2017-06-12 02:46:11 +02: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-06-12 03:02:57 +02:00
|
|
|
2.13.1
|
2017-06-12 02:46:11 +02:00
|
|
|
|