small changes

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

View File

@ -262,8 +262,8 @@ public class Citizens extends JavaPlugin {
if (!key.keyExists("name"))
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(type), id, key.getString("name"), null);
NPC npc = npcManager.createNPC(EntityType.valueOf(key.getString("traits.type").toUpperCase()), id, key
.getString("name"), null);
try {
npc.load(key);
} catch (NPCException ex) {

View File

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