package org.inventivetalent.npclib.event;

import com.google.common.base.Preconditions;
import org.bukkit.Location;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.inventivetalent.npclib.npc.NPCAbstract;

public class NPCSpawnEvent extends NPCEvent {

	private CreatureSpawnEvent.SpawnReason spawnReason;

	public NPCSpawnEvent(NPCAbstract npc, CreatureSpawnEvent.SpawnReason spawnReason) {
		super(npc);
		this.spawnReason = spawnReason;
	}

	public Location getLocation() {
		return getNpc().getBukkitEntity().getLocation();
	}

	public CreatureSpawnEvent.SpawnReason getSpawnReason() {
		return spawnReason;
	}

	public void setSpawnReason(CreatureSpawnEvent.SpawnReason spawnReason) {
		Preconditions.checkNotNull(spawnReason);
		this.spawnReason = spawnReason;
	}

	private static HandlerList handlerList = new HandlerList();

	@Override
	public HandlerList getHandlers() {
		return handlerList;
	}

	public static HandlerList getHandlerList() {
		return handlerList;
	}
}

@@ -249,16 +249,100 @@
 tract;%0A%0A
+import javax.annotation.Nonnull;%0A%0A/**%0A * Event called when a new NPC is spawned%0A */%0A
 public c
@@ -576,94 +576,312 @@
 %7D%0A%0A%09
-public Location getLocation() %7B%0A%09%09return getNpc().getBukkitEntity().getLocation();%0A%09%7D%0A
+/**%0A%09 * Get the location where the NPC was spawned%0A%09 *%0A%09 * @return the spawn %7B@link Location%7D%0A%09 */%0A%09public Location getLocation() %7B%0A%09%09return getNpc().getBukkitEntity().getLocation();%0A%09%7D%0A%0A%09/**%0A%09 * Get the spawn reason%0A%09 *%0A%09 * @return the %7B@link org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason%7D%0A%09 */
 %0A%09pu
@@ -957,24 +957,107 @@
 Reason;%0A%09%7D%0A%0A
+%09/**%0A%09 * Set the spawn reason%0A%09 *%0A%09 * @param spawnReason the new spawn reason%0A%09 */%0A
 %09public void
@@ -1072,16 +1072,25 @@
 nReason(
+@Nonnull 
 Creature

add javadoc for NPCSpawnEvent