mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-05 02:10:10 +01:00
Moving the spawn call was ill-advised
This commit is contained in:
parent
0349b64c23
commit
9f085b2692
@ -89,14 +89,6 @@ public abstract class CitizensNPC extends AbstractNPC {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void load(final DataKey root) {
|
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"));
|
metadata.loadFrom(root.getRelative("metadata"));
|
||||||
// Load traits
|
// Load traits
|
||||||
|
|
||||||
@ -126,6 +118,11 @@ public abstract class CitizensNPC extends AbstractNPC {
|
|||||||
loadTrait(trait, traitKey);
|
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"));
|
navigator.load(root.getRelative("navigator"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,10 +193,6 @@ public class LinearWaypointProvider implements WaypointProvider {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if (npc == null) {
|
|
||||||
end();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!event.getPlayer().equals(player) || event.getAction() == Action.PHYSICAL)
|
if (!event.getPlayer().equals(player) || event.getAction() == Action.PHYSICAL)
|
||||||
return;
|
return;
|
||||||
if (event.getPlayer().getWorld() != npc.getBukkitEntity().getWorld())
|
if (event.getPlayer().getWorld() != npc.getBukkitEntity().getWorld())
|
||||||
|
Loading…
Reference in New Issue
Block a user