package org.inventivetalent.npclib;

import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.inventivetalent.apihelper.APIManager;
import org.inventivetalent.npclib.command.SpawnCommands;
import org.inventivetalent.npclib.event.NBTWriteEvent;
import org.inventivetalent.npclib.registry.NPCRegistry;
import org.inventivetalent.pluginannotations.PluginAnnotations;

public class NPCLibPlugin extends JavaPlugin implements Listener {

	private NPCLib npcLibInstance = new NPCLib();
	private NPCRegistry pluginNpcRegistry;

	@Override
	public void onLoad() {
		APIManager.registerAPI(npcLibInstance, this);
	}

	@Override
	public void onEnable() {
		NPCLib.logger = getLogger();

		APIManager.initAPI(NPCLib.class);
		pluginNpcRegistry = NPCLib.createRegistry(this);

		Bukkit.getPluginManager().registerEvents(this, this);
		PluginAnnotations.COMMAND.load(this, new SpawnCommands(this));
	}

	@Override
	public void onDisable() {
		APIManager.disableAPI(NPCLib.class);
	}

	public NPCRegistry getPluginNpcRegistry() {
		return pluginNpcRegistry;
	}

	@EventHandler(priority = EventPriority.MONITOR)
	public void on(CreatureSpawnEvent event) {
		System.out.println(event);
		System.out.println(event.isCancelled());
		event.setCancelled(false);
	}

	@EventHandler
	public void on(NBTWriteEvent event) {
		event.getNbtTag().set("NPCLib.npcType", event.getNpc().getNpcType().name());
	}
}

@@ -370,63 +370,8 @@
 ds;%0A
-import org.inventivetalent.npclib.event.NBTWriteEvent;%0A
 impo
@@ -1372,142 +1372,5 @@
 %09%7D%0A%0A
-%09@EventHandler%0A%09public void on(NBTWriteEvent event) %7B%0A%09%09event.getNbtTag().set(%22NPCLib.npcType%22, event.getNpc().getNpcType().name());%0A%09%7D%0A%7D%0A
+%7D

remove NBT test event