Skip to content

Commit

Permalink
Fix custom rewards not given if override set
Browse files Browse the repository at this point in the history
  • Loading branch information
PikaMug committed Aug 27, 2024
1 parent 98441a6 commit 400b4b2
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions core/src/main/java/me/pikamug/quests/quests/BukkitQuest.java
Original file line number Diff line number Diff line change
Expand Up @@ -890,12 +890,24 @@ public void completeQuest(final Quester quester, final boolean allowMultiplayer)
}
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?");
}
}

Expand Down Expand Up @@ -1064,11 +1076,6 @@ public void completeQuest(final Quester quester, final boolean allowMultiplayer)
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?");
}
}
}
Expand Down

0 comments on commit 400b4b2

Please sign in to comment.