Added ItemDespawnEvent

By: Feildmaster <admin@feildmaster.com>
This commit is contained in:
Bukkit/Spigot 2011-10-16 20:47:49 -05:00
parent 544b0a05ae
commit 40f4710726
4 changed files with 52 additions and 0 deletions

View File

@ -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

View File

@ -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) {}
}

View File

@ -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;
}
}

View File

@ -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() {