From 3e975a30a1415f3eb55425392bdd0f9b94cbce03 Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Fri, 10 Apr 2020 18:17:41 -0400 Subject: [PATCH] Check quest before multiplayer dispatch, fixes #1185. Bump version --- dist/pom.xml | 2 +- main/pom.xml | 2 +- .../src/main/java/me/blackvein/quests/Quester.java | 14 ++++++++++++-- pom.xml | 4 ++-- v1_8_R1/pom.xml | 2 +- v1_8_R2/pom.xml | 2 +- v1_8_R3/pom.xml | 2 +- 7 files changed, 19 insertions(+), 9 deletions(-) diff --git a/dist/pom.xml b/dist/pom.xml index 2a8e1e9f2..c3a4ba4a6 100644 --- a/dist/pom.xml +++ b/dist/pom.xml @@ -5,7 +5,7 @@ me.blackvein.quests quests-parent - 3.9.2 + 3.9.3 quests-dist pom diff --git a/main/pom.xml b/main/pom.xml index 2a06ec647..bc8ca281e 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -4,7 +4,7 @@ me.blackvein.quests quests-parent - 3.9.2 + 3.9.3 quests-main diff --git a/main/src/main/java/me/blackvein/quests/Quester.java b/main/src/main/java/me/blackvein/quests/Quester.java index 2c0029891..65b8c6f08 100644 --- a/main/src/main/java/me/blackvein/quests/Quester.java +++ b/main/src/main/java/me/blackvein/quests/Quester.java @@ -3676,13 +3676,16 @@ public class Quester { * @param fun The function to execute, the event call */ public void dispatchMultiplayerEverything(Quest quest, String objectiveType, Function fun) { + if (quest == null) { + return; + } if (quest.getOptions().getShareProgressLevel() == 1) { List mq = getMultiplayerQuesters(quest); if (mq == null) { return; } for (Quester q : mq) { - if (q.getCurrentStage(quest).containsObjective(objectiveType)) { + if (q != null && q.getCurrentStage(quest).containsObjective(objectiveType)) { if (this.getCurrentStage(quest).containsObjective(objectiveType) || !quest.getOptions().getRequireSameQuest()) { fun.apply(q); @@ -3700,10 +3703,17 @@ public class Quester { * @param fun The function to execute, the event call */ public void dispatchMultiplayerObjectives(Quest quest, Stage currentStage, Function fun) { + if (quest == null) { + return; + } if (quest.getOptions().getShareProgressLevel() == 2) { List mq = getMultiplayerQuesters(quest); + if (mq == null) { + return; + } for (Quester q : mq) { - if ((q.getCurrentQuests().containsKey(quest) && currentStage.equals(q.getCurrentStage(quest))) + if (q != null + && (q.getCurrentQuests().containsKey(quest) && currentStage.equals(q.getCurrentStage(quest))) || !quest.getOptions().getRequireSameQuest()) { fun.apply(q); } diff --git a/pom.xml b/pom.xml index 060323991..441a1f35b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,12 +6,12 @@ me.blackvein.quests quests-parent - 3.9.2 + 3.9.3 quests https://github.com/PikaMug/Quests/ - 3.9.2 + 3.9.3 UTF-8 1.8 1.8 diff --git a/v1_8_R1/pom.xml b/v1_8_R1/pom.xml index fd2fc67dd..95ba9636b 100644 --- a/v1_8_R1/pom.xml +++ b/v1_8_R1/pom.xml @@ -5,7 +5,7 @@ me.blackvein.quests quests-parent - 3.9.2 + 3.9.3 diff --git a/v1_8_R2/pom.xml b/v1_8_R2/pom.xml index ac347337a..b63492f75 100644 --- a/v1_8_R2/pom.xml +++ b/v1_8_R2/pom.xml @@ -5,7 +5,7 @@ me.blackvein.quests quests-parent - 3.9.2 + 3.9.3 diff --git a/v1_8_R3/pom.xml b/v1_8_R3/pom.xml index 4a85e62ad..99d1dc975 100644 --- a/v1_8_R3/pom.xml +++ b/v1_8_R3/pom.xml @@ -5,7 +5,7 @@ me.blackvein.quests quests-parent - 3.9.2 + 3.9.3