@Override public void cancelQuest(Player player, String questName) { Quester quester = getQuester(player); Quest currentQuest = quester.currentQuest; if (currentQuest != null && currentQuest.name.equalsIgnoreCase(questName)) { currentQuest.failQuest(quester); } }
@Override public void completeObjectives(Player player, String questName, List<Integer> objectivesIDs) { Quester quester = getQuester(player); Quest currentQuest = getQuest(questName); if (currentQuest != null && currentQuest.name.equalsIgnoreCase(questName) && !objectivesIDs.isEmpty()) { Collections.sort(objectivesIDs); int lastObjectiveID = objectivesIDs.get(objectivesIDs.size() - 1); while (quester.currentQuest == currentQuest && quester.currentStageIndex >= lastObjectiveID) { currentQuest.nextStage(quester); } } }
@Override public void completeQuest(Player player, String questName) { Quester quester = getQuester(player); Quest currentQuest = quester.currentQuest; if (currentQuest != null && currentQuest.name.equalsIgnoreCase(questName)) { currentQuest.completeQuest(quester); } else { /* We have to restore previous state or the current quest will be cancelled. * It would be the best to also restore objective progress, but * the plugin doesn't provide a way to do it */ Stage currentStage = quester.currentStage; int currentStageIndex = quester.currentStageIndex; getQuest(questName).completeQuest(quester); quester.currentQuest = currentQuest; quester.currentStage = currentStage; quester.currentStageIndex = currentStageIndex; quester.startStageTimer(); } }