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);
 }
 public QuestProgress(Quest quest, Player owner) {
   this.quest = quest;
   this.owner = owner;
   CurrentStage = 0;
   objlist = new ArrayList<>();
   for (SimpleQuestObject o : quest.getStage(CurrentStage).getObjects()) {
     objlist.add(new QuestObjectProgress(o, 0));
   }
 }
 public void save(QuestIO io) {
   io.set(
       "玩家資料." + owner.getUniqueId() + ".任務進度." + quest.getInternalID() + ".QuestStage",
       CurrentStage);
   int t = 0;
   int value = 0;
   for (QuestObjectProgress qop : objlist) {
     if (qop.isFinished()) {
       if (qop.getObject() instanceof QuestObjectTalkToNPC
           || qop.getObject() instanceof QuestObjectReachLocation) value = 1;
       else if (qop.getObject() instanceof NumerableObject)
         value = ((NumerableObject) qop.getObject()).getAmount();
     } else value = qop.getProgress();
     io.set(
         "玩家資料."
             + owner.getUniqueId()
             + ".任務進度."
             + quest.getInternalID()
             + ".QuestObjectProgress."
             + t,
         value);
     t++;
   }
 }
 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();
   }
 }