From 3c8acea21a05ab432601f150b4103d9c38ac3c9a Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Sat, 1 Apr 2023 13:51:58 -0400 Subject: [PATCH] Ignore quest requirements if empty, fixes #2083 --- .../src/main/java/me/blackvein/quests/Quest.java | 6 ++++-- .../main/java/me/blackvein/quests/Quester.java | 16 ++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/me/blackvein/quests/Quest.java b/core/src/main/java/me/blackvein/quests/Quest.java index face95ecf..8dde6f415 100644 --- a/core/src/main/java/me/blackvein/quests/Quest.java +++ b/core/src/main/java/me/blackvein/quests/Quest.java @@ -590,10 +590,12 @@ public class Quest implements IQuest { return false; } for (final IQuest q : quester.getCompletedQuestsTemp()) { - if (!requirements.getNeededQuestIds().contains(q.getName())) { + if (!requirements.getNeededQuestIds().isEmpty() + && requirements.getNeededQuestIds().contains(q.getName())) { return false; } - if (!requirements.getBlockQuestIds().contains(q.getName())) { + if (!requirements.getBlockQuestIds().isEmpty() + && !requirements.getBlockQuestIds().contains(q.getName())) { return false; } } diff --git a/core/src/main/java/me/blackvein/quests/Quester.java b/core/src/main/java/me/blackvein/quests/Quester.java index be5b28c28..89a59d830 100644 --- a/core/src/main/java/me/blackvein/quests/Quester.java +++ b/core/src/main/java/me/blackvein/quests/Quester.java @@ -1056,13 +1056,17 @@ public class Quester implements IQuester { } for (final IQuest q : completedQuests) { if (q != null) { - if (requirements.getNeededQuestIds().contains(q.getId())) { - finishedRequirements.add(ChatColor.GREEN + q.getName()); - } else { - unfinishedRequirements.add(ChatColor.GRAY + q.getName()); + if (!requirements.getNeededQuestIds().isEmpty()) { + if (requirements.getNeededQuestIds().contains(q.getId())) { + finishedRequirements.add(ChatColor.GREEN + q.getName()); + } else { + unfinishedRequirements.add(ChatColor.GRAY + q.getName()); + } } - if (requirements.getBlockQuestIds().contains(q.getId())) { - current.add(ChatColor.RED + quest.getName()); + if (!requirements.getBlockQuestIds().isEmpty()) { + if (requirements.getBlockQuestIds().contains(q.getId())) { + current.add(ChatColor.RED + quest.getName()); + } } } }