From 50a73bb4633e566dbd10b346d9f9890e2cf9c735 Mon Sep 17 00:00:00 2001 From: PikaMug Date: Thu, 5 Sep 2019 23:39:48 -0400 Subject: [PATCH] Fix Denizen scripts not running if quest has multiple stages, fixes #931 --- .../main/java/me/blackvein/quests/Quest.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/main/src/main/java/me/blackvein/quests/Quest.java b/main/src/main/java/me/blackvein/quests/Quest.java index 6fcd38966..763f1cae5 100644 --- a/main/src/main/java/me/blackvein/quests/Quest.java +++ b/main/src/main/java/me/blackvein/quests/Quest.java @@ -174,26 +174,19 @@ public class Quest { q.findCompassTarget(); } if (q.getCurrentStage(this).delay < 0) { + if (q.getCurrentStage(this).finishEvent != null) { + q.getCurrentStage(this).finishEvent.fire(q, this); + } if (q.currentQuests.get(this) == (orderedStages.size() - 1)) { if (q.getCurrentStage(this).script != null) { plugin.getDenizenTrigger().runDenizenScript(q.getCurrentStage(this).script, q); } - if (q.getCurrentStage(this).finishEvent != null) { - q.getCurrentStage(this).finishEvent.fire(q, this); - } completeQuest(q); } else { try { - if (q.getCurrentStage(this).finishEvent != null) { - q.getCurrentStage(this).finishEvent.fire(q, this); - } setStage(q, q.currentQuests.get(this) + 1); - } catch (InvalidStageException e) { - e.printStackTrace(); - } - - // Multiplayer - try { + + // Multiplayer if (opts.getShareProgressLevel() == 3) { List mq = q.getMultiplayerQuesters(this); if (mq != null) { @@ -239,7 +232,7 @@ public class Quest { quester.hardStagePut(this, stage); quester.addEmptiesFor(this, stage); if (currentStage.script != null) { - plugin.getDenizenTrigger().runDenizenScript(quester.getCurrentStage(this).script, quester); + plugin.getDenizenTrigger().runDenizenScript(currentStage.script, quester); } /* * if (quester.getCurrentStage(this).finishEvent != null) { quester.getCurrentStage(this).finishEvent.fire(quester); }