Esempio n. 1
0
 public void finish() {
   for (QuestTrigger t : quest.getTriggers()) {
     if (t.getType().equals(TriggerType.TRIGGER_ON_FINISH)) {
       t.trigger(owner);
       continue;
     }
   }
   QuestPlayerData pd = QuestUtil.getData(owner);
   pd.addFinishedQuest(quest);
   quest.getQuestReward().giveRewardTo(owner);
   QuestUtil.sendQuestTitle(owner, quest, QuestTitleEnum.FINISH);
   QuestUtil.info(owner, "&b&l任務 &f" + quest.getQuestName() + " &b&l完成!");
   pd.removeProgress(quest);
 }
Esempio n. 2
0
 public void nextStage() {
   if (quest.hasTrigger()) {
     for (QuestTrigger t : quest.getTriggers()) {
       if (t.getType().equals(TriggerType.TRIGGER_STAGE_FINISH)) {
         if (CurrentStage + 1 == t.getCount()) {
           t.trigger(owner);
           continue;
         }
       } else if (t.getType().equals(TriggerType.TRIGGER_STAGE_START)) {
         if (CurrentStage + 2 == t.getCount()) {
           t.trigger(owner);
           continue;
         }
       }
     }
   }
   if (CurrentStage + 1 < quest.getStages().size()) {
     CurrentStage++;
     owner.sendMessage(
         ChatColor.translateAlternateColorCodes(
             '&',
             QuestStorage.prefix
                 + " &d&l任務 &f"
                 + quest.getQuestName()
                 + " &d&l已完成進度: ("
                 + CurrentStage
                 + "/"
                 + quest.getStages().size()
                 + ")"));
     objlist = new ArrayList<>();
     for (SimpleQuestObject o : quest.getStage(CurrentStage).getObjects()) {
       objlist.add(new QuestObjectProgress(o, 0));
     }
   } else if (CurrentStage + 1 >= quest.getStages().size()) {
     finish();
   }
 }