return;
}
}
if (index < 0)
index = 0;
PathEditingSession editing = NPCDataManager.pathEditors.get(player);
int UID = npc.getUID();
if (editing == null) {
player.sendMessage(ChatColor.AQUA + StringUtils.listify("Waypoint Editing Controls"));
player.sendMessage(StringUtils.wrap("Left") + " click adds a waypoint, while "
+ StringUtils.wrap("right") + " click acts as an undo.");
player.sendMessage(StringUtils.wrap("Right clicking")
+ " the NPC will cause him to restart from the current index.");
player.sendMessage(StringUtils.wrap("Repeat") + " this command to finish.");
editing = new PathEditingSession(UID, index);
} else if (editing.getUID() == UID && args.argsLength() == 1) {
player.sendMessage(StringUtils.wrap("Finished") + " editing waypoints.");
NPCDataManager.pathEditors.remove(player);
return;
} else if (editing.getUID() != UID) {
player.sendMessage(ChatColor.GRAY + "Now editing " + StringUtils.wrap(npc.getName())
+ "'s waypoints.");
editing = new PathEditingSession(UID, index);
}
if (npc.getWaypoints().size() > 0) {
npc.getWaypoints().setIndex(index);
npc.teleport(npc.getWaypoints().get(index).getLocation());
}