Package net.citizensnpcs.waypoints

Examples of net.citizensnpcs.waypoints.WaypointPath


            }
        }
    }

    private void updateWaypoints(HumanNPC npc) {
        WaypointPath waypoints = npc.getWaypoints();
        switch (waypoints.size()) {
            case 0:
                break;
            case 1:
                // TODO: merge the default and this case.
                if (waypoints.currentIndex() >= 1) {
                    if (!waypoints.isStarted()) {
                        waypoints.schedule(npc, 0);
                    }
                    if (waypoints.isStarted() && !npc.isPaused() && npc.getHandle().pathFinished()) {
                        waypoints.setIndex(0);
                    }
                } else {
                    if (!npc.getWaypoints().isStarted()) {
                        PathUtils.createPath(npc, npc.getNPCData().getLocation(), -1, -1,
                                Settings.getDouble("PathfindingRange"));
                        waypoints.setStarted(true);
                    }
                    if (waypoints.isStarted() && !npc.isPaused() && npc.getHandle().pathFinished()) {
                        waypoints.setIndex(1);
                    }
                }
                if (waypoints.isStarted() && !npc.isPaused() && npc.getHandle().pathFinished()) {
                    waypoints.setStarted(false);
                    waypoints.onReach(npc);
                }
                break;
            default:
                if (!waypoints.isStarted()) {
                    waypoints.scheduleNext(npc);
                }
                if (waypoints.isStarted() && !npc.isPaused() && npc.getHandle().pathFinished()) {
                    waypoints.setIndex(waypoints.currentIndex() + 1);
                    waypoints.setStarted(false);
                    waypoints.onReach(npc);
                }
        }
    }
View Full Code Here


        waypoints.remove(index--);
        rangeCheck(waypoints);
    }

    public void restartAtIndex() {
        WaypointPath path = getNPC().getWaypoints();
        if (path.size() == 0)
            return;
        path.setIndex(index);
        getNPC().teleport(path.current().getLocation());
    }
View Full Code Here

        return (T) this.types.get(type);
    }

    public WaypointPath getWaypoints() {
        if (waypoints == null) {
            this.waypoints = new WaypointPath();
        }
        return this.waypoints;
    }
View Full Code Here

TOP

Related Classes of net.citizensnpcs.waypoints.WaypointPath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.