public void updateObjectiveStatus() { for (CollectionGoalStatus goalStatus : goalsStatus) { ArrayList<String> templateList = new ArrayList<String>(); for (int i = 0; i < goalStatus.getTargetCount(); i++) { templateList.add(goalStatus.getTemplateName()); } if (templateList.size() > 0) { List<Long> findResult = InventoryClient.findItems(getPlayerOid(), templateList); goalStatus.currentCount = 0; for (Long itemOid : findResult) { if (itemOid != null) { goalStatus.currentCount++; } } } } updateQuestObjectives(); // update quest completed flag for (CollectionGoalStatus goalStatus : goalsStatus) { if (goalStatus.currentCount < goalStatus.targetCount) { log.debug("updateObjectiveStatus: quest not completed"); boolean wasComplete = getCompleted(); setCompleted(false); if (wasComplete) { // we were complete, but no longer, so update sendStateStatusChange(); } return; } } if (getCompleted()) { // already completed, ignore return; } log.debug("updateObjectiveStatus: quest is completed"); setCompleted(true); sendStateStatusChange(); WorldManagerClient.sendObjChatMsg(playerOid, 0, "You have completed quest " + getName()); }