Warn if custom reward has no name, fixes #53. Bump version number

This commit is contained in:
HappyPikachu 2017-07-19 01:00:51 -04:00
parent 71f5496c64
commit 038c3dc86f

View File

@ -423,13 +423,17 @@ public class Quest {
if (found != null) { if (found != null) {
Map<String, Object> datamap = customRewards.get(found.getName()); Map<String, Object> datamap = customRewards.get(found.getName());
String message = found.getRewardName(); String message = found.getRewardName();
for (String key : datamap.keySet()) { if (message != null) {
message = message.replaceAll("%" + ((String) key) + "%", ((String) datamap.get(key))); for (String key : datamap.keySet()) {
message = message.replaceAll("%" + ((String) key) + "%", ((String) datamap.get(key)));
}
player.sendMessage("- " + ChatColor.GOLD + message);
} else {
plugin.getLogger().warning("Failed to notify player: Custom Reward does not have an assigned name");
} }
player.sendMessage("- " + ChatColor.GOLD + message);
found.giveReward(player, customRewards.get(s)); found.giveReward(player, customRewards.get(s));
} else { } else {
plugin.getLogger().warning("[Quests] Quester \"" + player.getName() + "\" completed the Quest \"" + name + "\", but the Custom Reward \"" + s + "\" could not be found. Does it still exist?"); plugin.getLogger().warning("Quester \"" + player.getName() + "\" completed the Quest \"" + name + "\", but the Custom Reward \"" + s + "\" could not be found. Does it still exist?");
} }
none = null; none = null;
} }