fix command NPE

This commit is contained in:
aPunch 2012-02-19 14:21:35 -06:00
parent c89724b391
commit 12a0c3b32a
2 changed files with 2 additions and 6 deletions

View File

@ -45,8 +45,6 @@ public class EventListen implements Listener {
NPC npc = npcManager.getNPC(id); NPC npc = npcManager.getNPC(id);
Location loc = npc.getTrait(SpawnLocation.class).getLocation(); Location loc = npc.getTrait(SpawnLocation.class).getLocation();
npc.spawn(loc); npc.spawn(loc);
Messaging.log("Spawned " + npc.getId() + " at " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ()
+ " in world " + loc.getWorld().getName());
} }
toRespawn.remove(event.getChunk()); toRespawn.remove(event.getChunk());
} }
@ -63,8 +61,6 @@ public class EventListen implements Listener {
Location loc = npc.getBukkitEntity().getLocation(); Location loc = npc.getBukkitEntity().getLocation();
if (event.getWorld().equals(loc.getWorld()) && event.getChunk().getX() == loc.getChunk().getX() if (event.getWorld().equals(loc.getWorld()) && event.getChunk().getX() == loc.getChunk().getX()
&& event.getChunk().getZ() == loc.getChunk().getZ()) { && event.getChunk().getZ() == loc.getChunk().getZ()) {
Messaging.log("Despawned " + npc.getId() + " at " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ()
+ " in world " + loc.getWorld().getName());
npc.getTrait(SpawnLocation.class).setLocation(loc); npc.getTrait(SpawnLocation.class).setLocation(loc);
npc.despawn(); npc.despawn();
respawn.add(npc.getId()); respawn.add(npc.getId());

View File

@ -38,8 +38,8 @@ public class NPCCommands {
public void showInfo(CommandContext args, Player player, NPC npc) { public void showInfo(CommandContext args, Player player, NPC npc) {
Messaging.send(player, StringHelper.wrapHeader(npc.getName())); Messaging.send(player, StringHelper.wrapHeader(npc.getName()));
Messaging.send(player, " <a>ID: <e>" + npc.getId()); Messaging.send(player, " <a>ID: <e>" + npc.getId());
Messaging.send(player, " <a>Character: <e>" + npc.getCharacter() != null ? npc.getCharacter().getName() Messaging.send(player, " <a>Character: <e>" + (npc.getCharacter() != null ? npc.getCharacter().getName()
: "None"); : "None"));
} }
@Command( @Command(