From 400b4b2cc925a9a22453077d65a14eb1aa4d73eb Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:39:58 -0400 Subject: [PATCH] Fix custom rewards not given if override set --- .../me/pikamug/quests/quests/BukkitQuest.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/me/pikamug/quests/quests/BukkitQuest.java b/core/src/main/java/me/pikamug/quests/quests/BukkitQuest.java index 9250018d4..c8aa77306 100644 --- a/core/src/main/java/me/pikamug/quests/quests/BukkitQuest.java +++ b/core/src/main/java/me/pikamug/quests/quests/BukkitQuest.java @@ -890,12 +890,24 @@ public class BukkitQuest implements Quest { } issuedReward = true; } - if (!rewards.getCustomRewards().isEmpty()) { - issuedReward = true; - if (plugin.getConfigSettings().getConsoleLogging() > 2) { - for (final String s : rewards.getCustomRewards().keySet()) { + for (final String s : rewards.getCustomRewards().keySet()) { + CustomReward found = null; + for (final CustomReward cr : plugin.getCustomRewards()) { + if (cr.getName().equalsIgnoreCase(s)) { + found = cr; + break; + } + } + if (found != null) { + found.giveReward(player.getUniqueId(), rewards.getCustomRewards().get(s)); + issuedReward = true; + if (plugin.getConfigSettings().getConsoleLogging() > 2) { plugin.getLogger().info(player.getUniqueId() + " was custom rewarded " + s); } + } else { + plugin.getLogger().warning("Quester \"" + player.getName() + "\" completed the Quest \"" + + name + "\", but the Custom Reward \"" + s + + "\" could not be found. Does it still exist?"); } } @@ -1064,11 +1076,6 @@ public class BukkitQuest implements Quest { plugin.getLogger().warning("Failed to notify player: " + "Custom Reward does not have an assigned name"); } - found.giveReward(p.getUniqueId(), rewards.getCustomRewards().get(s)); - } else { - plugin.getLogger().warning("Quester \"" + player.getName() + "\" completed the Quest \"" - + name + "\", but the Custom Reward \"" + s - + "\" could not be found. Does it still exist?"); } } }