testserver/Spigot-Server-Patches/0211-EntityPickupItemEvent....

43 lines
1.6 KiB
Diff

From 8dc26cb4650fa9a4825cc14552845ed6f010ecb3 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 5 May 2017 01:16:22 -0500
Subject: [PATCH] EntityPickupItemEvent
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 1d26555d..8cc55734 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -10,8 +10,11 @@ import java.util.UUID;
import javax.annotation.Nullable;
// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftItem;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityUnleashEvent;
@@ -558,6 +561,18 @@ public abstract class EntityInsentient extends EntityLiving {
}
if (flag && this.c(itemstack)) {
+
+ // Paper Start
+ EntityPickupItemEvent event = new EntityPickupItemEvent((LivingEntity) this.getBukkitEntity(), new CraftItem(this.world.getServer(), entityitem));
+ this.world.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
+ }
+ // Paper end
+
double d0;
switch (enumitemslot.a()) {
--
2.11.0