Paper/Spigot-API-Patches/0051-EntityPickupItemEvent.patch

64 Zeilen
1.6 KiB
Diff

From a22f01307daf61a282adc1665cffc08e47871490 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 5 May 2017 01:16:10 -0500
Subject: [PATCH] EntityPickupItemEvent
diff --git a/src/main/java/org/bukkit/event/entity/EntityPickupItemEvent.java b/src/main/java/org/bukkit/event/entity/EntityPickupItemEvent.java
new file mode 100644
index 00000000..f485f313
--- /dev/null
+++ b/src/main/java/org/bukkit/event/entity/EntityPickupItemEvent.java
@@ -0,0 +1,46 @@
+package org.bukkit.event.entity;
+
+import org.bukkit.entity.Item;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+
+/**
+ * Thrown when an entity picks an item up from the ground
+ */
+public class EntityPickupItemEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final Item item;
+ private boolean cancel = false;
+
+ public EntityPickupItemEvent(final LivingEntity entity, final Item item) {
+ super(entity);
+ this.item = item;
+ }
+
+ /**
+ * Gets the Item picked up by the entity.
+ *
+ * @return Item
+ */
+ public Item getItem() {
+ return item;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.11.0