3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Paper/Spigot-API-Patches/0056-EntityPickupItemEvent.patch

64 Zeilen
1.6 KiB
Diff

From 92a2a2f1b72749139bbbb785746b546a3741474f 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..3d40b515
--- /dev/null
+++ b/src/main/java/org/bukkit/event/entity/EntityPickupItemEvent.java
@@ -0,0 +1,48 @@
+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.13.1