small changes

This commit is contained in:
aPunch 2012-03-05 18:32:53 -06:00
parent b43ab6d28c
commit caf17734de
2 changed files with 9 additions and 6 deletions

View File

@ -262,8 +262,8 @@ public class Citizens extends JavaPlugin {
if (!key.keyExists("name")) if (!key.keyExists("name"))
throw new NPCLoadException("Could not find a name for the NPC with ID '" + id + "'."); throw new NPCLoadException("Could not find a name for the NPC with ID '" + id + "'.");
String type = key.getString("traits.type").toUpperCase(); NPC npc = npcManager.createNPC(EntityType.valueOf(key.getString("traits.type").toUpperCase()), id, key
NPC npc = npcManager.createNPC(EntityType.valueOf(type), id, key.getString("name"), null); .getString("name"), null);
try { try {
npc.load(key); npc.load(key);
} catch (NPCException ex) { } catch (NPCException ex) {

View File

@ -43,7 +43,7 @@ public class EventListen implements Listener {
} }
/* /*
* World events * Chunk events
*/ */
@EventHandler @EventHandler
public void onChunkLoad(ChunkLoadEvent event) { public void onChunkLoad(ChunkLoadEvent event) {
@ -122,6 +122,9 @@ public class EventListen implements Listener {
npc.getCharacter().onRightClick(npc, player); npc.getCharacter().onRightClick(npc, player);
} }
/*
* Player events
*/
@EventHandler @EventHandler
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) { public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
if (!(((CraftPlayer) event.getPlayer()).getHandle() instanceof EntityHumanNPC)) if (!(((CraftPlayer) event.getPlayer()).getHandle() instanceof EntityHumanNPC))
@ -139,14 +142,14 @@ public class EventListen implements Listener {
new EntityTargetEvent(event.getRightClicked(), event.getPlayer(), TargetReason.CUSTOM)); new EntityTargetEvent(event.getRightClicked(), event.getPlayer(), TargetReason.CUSTOM));
} }
/*
* Player events
*/
@EventHandler @EventHandler
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
Editor.leave(event.getPlayer()); Editor.leave(event.getPlayer());
} }
/*
* World events
*/
@EventHandler @EventHandler
public void onWorldLoad(WorldLoadEvent event) { public void onWorldLoad(WorldLoadEvent event) {
for (Pair<Integer, Integer> chunk : toRespawn.keySet()) { for (Pair<Integer, Integer> chunk : toRespawn.keySet()) {