summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/event/Event.java6
-rw-r--r--src/main/java/org/bukkit/event/entity/EntityListener.java7
-rw-r--r--src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java32
-rw-r--r--src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java7
4 files changed, 52 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java
index 095c19c6..681cca94 100644
--- a/src/main/java/org/bukkit/event/Event.java
+++ b/src/main/java/org/bukkit/event/Event.java
@@ -600,6 +600,12 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.world.TreeGrowEvent
*/
STRUCTURE_GROW(Category.WORLD),
+ /**
+ * Called when an item despawns from a world
+ *
+ * @see org.bukkit.event.entity.ItemDespawnEvent
+ */
+ ITEM_DESPAWN (Category.WORLD),
/**
* ENTITY EVENTS
diff --git a/src/main/java/org/bukkit/event/entity/EntityListener.java b/src/main/java/org/bukkit/event/entity/EntityListener.java
index b4399736..1e34b890 100644
--- a/src/main/java/org/bukkit/event/entity/EntityListener.java
+++ b/src/main/java/org/bukkit/event/entity/EntityListener.java
@@ -162,4 +162,11 @@ public class EntityListener implements Listener {
* @param event Relevant event details
*/
public void onSlimeSplit(SlimeSplitEvent event) {}
+
+ /**
+ * Called when an item despawns from a world
+ *
+ * @param event Relevant event details
+ */
+ public void onItemDespawn(ItemDespawnEvent event) {}
}
diff --git a/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java b/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java
new file mode 100644
index 00000000..620e247a
--- /dev/null
+++ b/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java
@@ -0,0 +1,32 @@
+package org.bukkit.event.entity;
+
+import org.bukkit.Location;
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Cancellable;
+
+public class ItemDespawnEvent extends EntityEvent implements Cancellable {
+ private boolean canceled;
+ private Location location;
+
+ public ItemDespawnEvent(Entity spawnee, Location loc) {
+ super(Type.ITEM_DESPAWN, spawnee);
+ location = loc;
+ }
+
+ public boolean isCancelled() {
+ return canceled;
+ }
+
+ public void setCancelled(boolean cancel) {
+ canceled = cancel;
+ }
+
+ /**
+ * Gets the location at which the item is despawning.
+ *
+ * @return The location at which the item is despawning
+ */
+ public Location getLocation() {
+ return location;
+ }
+}
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 0bb16653..5126f9a0 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -840,6 +840,13 @@ public class JavaPluginLoader implements PluginLoader {
}
};
+ case ITEM_DESPAWN:
+ return new EventExecutor() {
+ public void execute(Listener listener, Event event) {
+ ((EntityListener) listener).onItemDespawn((ItemDespawnEvent) event);
+ }
+ };
+
// Vehicle Events
case VEHICLE_CREATE:
return new EventExecutor() {