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 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(); } }