@Override public void run() { CitizensConversation conv = (CitizensConversation) event.getConversation(); NPC npc = conv.getNPC(); if (!npcs.containsKey(npc)) { Navigator nav = npc.getNavigator(); npcs.put(npc, 1); locs.put(npc, nav.getTargetAsLocation()); nav.setPaused(true); nav.cancelNavigation(); nav.setTarget(conv.getNPC().getEntity().getLocation()); nav.setPaused(true); nav.cancelNavigation(); } else { npcs.put(npc, npcs.get(npc) + 1); } } }.runTask(BetonQuest.getInstance());
&& getNPC().getNavigator().getTargetAsLocation() != null && ((getNPC().getNavigator().getTargetAsLocation().getWorld().equals(entity.getWorld()) && getNPC().getNavigator().getTargetAsLocation().distanceSquared(entity.getLocation()) < 2 * 2))) { return;
@Override public boolean run(NPC npc, Navigator navigator) { if (!npc.isSpawned()) return false; Location base = navigator.getTargetAsLocation(); if (base == null || npc.getEntity().getWorld() == base.getWorld() && npc.getEntity().getLocation(CACHE_LOC).distanceSquared(base) <= RANGE) return true; Block block = base.getBlock(); int iterations = 0; while (!canStand(block)) { if (iterations++ >= MAX_ITERATIONS) { block = base.getBlock(); break; } block = block.getRelative(BlockFace.UP); } npc.teleport(block.getLocation(), TeleportCause.PLUGIN); return false; }