Sanity check

This commit is contained in:
fullwall 2012-10-30 22:40:15 +08:00
parent 670711f109
commit 5f6014d87d

View File

@ -193,10 +193,13 @@ 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 || !event.getPlayer().equals(player) if (npc == null) {
|| event.getAction() == Action.PHYSICAL) end();
return; return;
if (!npc.isSpawned() || event.getPlayer().getWorld() != npc.getBukkitEntity().getWorld()) }
if (!event.getPlayer().equals(player) || event.getAction() == Action.PHYSICAL)
return;
if (event.getPlayer().getWorld() != npc.getBukkitEntity().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)