This commit is contained in:
fullwall 2012-10-30 22:28:19 +08:00
parent d1e0d99395
commit 08ef13f6c4

View File

@ -15,7 +15,6 @@ import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.persistence.PersistenceLoader; import net.citizensnpcs.api.persistence.PersistenceLoader;
import net.citizensnpcs.api.util.DataKey; import net.citizensnpcs.api.util.DataKey;
import net.citizensnpcs.editor.Editor; import net.citizensnpcs.editor.Editor;
import net.citizensnpcs.trait.CurrentLocation;
import net.citizensnpcs.trait.waypoint.triggers.TriggerEditPrompt; import net.citizensnpcs.trait.waypoint.triggers.TriggerEditPrompt;
import net.citizensnpcs.util.Messages; import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging; import net.citizensnpcs.util.Messaging;
@ -194,11 +193,10 @@ public class LinearWaypointProvider implements WaypointProvider {
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getPlayer() == null) if (event.getPlayer() == null || !event.getPlayer().equals(player)
|| event.getAction() == Action.PHYSICAL)
return; return;
if (!event.getPlayer().equals(player) || event.getAction() == Action.PHYSICAL) if (!npc.isSpawned() || event.getPlayer().getWorld() != npc.getBukkitEntity().getWorld())
return;
if (event.getPlayer().getWorld() != npc.getTrait(CurrentLocation.class).getWorld())
return; return;
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_AIR) { if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_AIR) {
if (event.getClickedBlock() == null) if (event.getClickedBlock() == null)