Moving the spawn call was ill-advised

This commit is contained in:
fullwall 2012-10-30 22:47:44 +08:00
parent 0349b64c23
commit 9f085b2692
2 changed files with 5 additions and 12 deletions

View File

@ -89,14 +89,6 @@ public abstract class CitizensNPC extends AbstractNPC {
}
public void load(final DataKey root) {
// Spawn the NPC
Spawned spawned = getTrait(Spawned.class);
CurrentLocation spawnLocation = getTrait(CurrentLocation.class);
loadTrait(spawned, root.getRelative("traits.spawned"));
loadTrait(spawnLocation, root.getRelative("traits.location"));
if (spawned.shouldSpawn() && spawnLocation.getLocation() != null)
spawn(spawnLocation.getLocation());
metadata.loadFrom(root.getRelative("metadata"));
// Load traits
@ -126,6 +118,11 @@ public abstract class CitizensNPC extends AbstractNPC {
loadTrait(trait, traitKey);
}
// Spawn the NPC
CurrentLocation spawnLocation = getTrait(CurrentLocation.class);
if (getTrait(Spawned.class).shouldSpawn() && spawnLocation.getLocation() != null)
spawn(spawnLocation.getLocation());
navigator.load(root.getRelative("navigator"));
}

View File

@ -193,10 +193,6 @@ public class LinearWaypointProvider implements WaypointProvider {
@EventHandler(ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) {
if (npc == null) {
end();
return;
}
if (!event.getPlayer().equals(player) || event.getAction() == Action.PHYSICAL)
return;
if (event.getPlayer().getWorld() != npc.getBukkitEntity().getWorld())