001 package org.bukkit.event.entity; 002 003 import org.bukkit.entity.Item; 004 import org.bukkit.Location; 005 import org.bukkit.event.Cancellable; 006 import org.bukkit.event.HandlerList; 007 008 /** 009 * Called when an item is spawned into a world 010 */ 011 public class ItemSpawnEvent extends EntityEvent implements Cancellable { 012 private static final HandlerList handlers = new HandlerList(); 013 private final Location location; 014 private boolean canceled; 015 016 public ItemSpawnEvent(final Item spawnee, final Location loc) { 017 super(spawnee); 018 this.location = loc; 019 } 020 021 public boolean isCancelled() { 022 return canceled; 023 } 024 025 public void setCancelled(boolean cancel) { 026 canceled = cancel; 027 } 028 029 @Override 030 public Item getEntity() { 031 return (Item) entity; 032 } 033 034 /** 035 * Gets the location at which the item is spawning. 036 * 037 * @return The location at which the item is spawning 038 */ 039 public Location getLocation() { 040 return location; 041 } 042 043 @Override 044 public HandlerList getHandlers() { 045 return handlers; 046 } 047 048 public static HandlerList getHandlerList() { 049 return handlers; 050 } 051 }