Fix custom rewards not given if override set

This commit is contained in:
PikaMug 2024-08-27 11:39:58 -04:00
parent 98441a6b65
commit 400b4b2cc9

View File

@ -890,12 +890,24 @@ public class BukkitQuest implements Quest {
} }
issuedReward = true; issuedReward = true;
} }
if (!rewards.getCustomRewards().isEmpty()) { for (final String s : rewards.getCustomRewards().keySet()) {
issuedReward = true; CustomReward found = null;
if (plugin.getConfigSettings().getConsoleLogging() > 2) { for (final CustomReward cr : plugin.getCustomRewards()) {
for (final String s : rewards.getCustomRewards().keySet()) { 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); 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: " plugin.getLogger().warning("Failed to notify player: "
+ "Custom Reward does not have an assigned name"); + "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?");
} }
} }
} }