diff options
Diffstat (limited to 'src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java')
-rw-r--r-- | src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java b/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java new file mode 100644 index 00000000..bff7aa17 --- /dev/null +++ b/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java @@ -0,0 +1,47 @@ +package org.bukkit.event.entity; + +import org.bukkit.entity.Entity; +import org.bukkit.Location; +import org.bukkit.event.Cancellable; + +/** + * Called when an item is spawned into a world + */ +public class ItemSpawnEvent extends EntityEvent implements Cancellable { + + private Location location; + private boolean canceled; + + public ItemSpawnEvent(Entity spawnee, Location loc) { + super(Type.ITEM_SPAWN, spawnee); + this.location = loc; + } + + /** + * Gets the cancellation state of this event. A canceled event will not + * be executed in the server, but will still pass to other plugins + * + * @return true if this event is canceled + */ + public boolean isCancelled() { + return canceled; + } + + /** + * Sets the cancellation state of this event. A canceled event will not + * be executed in the server, but will still pass to other plugins + * + * @param cancel true if you wish to cancel this event + */ + public void setCancelled(boolean cancel) { + canceled = cancel; + } + + /** + * Gets the location at which the item is spawning. + * @return The location at which the item is spawning + */ + public Location getLocation() { + return location; + } +} |