Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/Spigot-Server-Patches/0216-EntityPickupItemEvent.patch
2017-06-18 20:37:08 -05:00

43 Zeilen
1.6 KiB
Diff

From 2bd8b2b7e764e6e93fe7ac9d037d65f240bf915a 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 a7bee79b..a93c0001 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;
@@ -568,6 +571,16 @@ 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.13.1.windows.2